Hackerrank Modified Kaprekar Numbers Solution

programming

This is the solution to the Modified Kaprekar Numbers found in the implementation section of the algorithm domain in Hackerrank. A modified Kaprekar number is a positive whole number n with d digits, such that when we split its square into two pieces – a right hand piece r with d digits and a left hand piece l that contains the remaining d or d−1 digits, the sum of the pieces is equal to the original number (i.e. l + r = n).       Screenshot The Code def…

Read More

My First webpage using Bootstrap Framework

Bootstrap webpage

In this post, you will learn to create your first webpage using the Bootstrap Framework. Bootstrap framework is a responsive framework. It automatically adjusts the site’s layout according to the device in which it is viewed. Responsiveness is given highest priority nowadays. This webpage using Bootstrap Framework uses basic components. Designing a webpage using Bootstrap Framework is easy and need to less few lines of code. Page Preview     Components used Containers Jumbotron Well Panels The Code <link href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css” rel=”stylesheet”> <div class=”container”> <div class=”jumbotron”> <h1>Page Title</h1> <h4>This is my first webpage in…

Read More

Bit Stuffing Code Implementation in Java

programming

This is an implementation of the Bit Stuffing popularly used in data communication, also known as one of the concepts of Framing data bits. Bit stuffingis the process of inserting noninformation bits into data to break up bit patterns to affect the synchronous transmission of information. It is widely used in network and communication protocols, in which bit stuffing is a required part of the transmission process.To know more please click here.    Sample Output: This is a sample output with data binary data entered as 11001111110. Code: import java.util.*; public…

Read More

How to create a WIFI Hotspot in your Laptop.

Utilities Wi-Fi

Sometimes we need to create a wifi hotspot while we have connected a dongle or wired broadband connection to a PC. Although we can use thirdparty software with pretty GUI do so, they often comes with a price tag. This method cam let you create own free Wi-Fi hotspot from any PC running Windows OS. Screenshots                             Commands We have to run the cmd as administration.First check weather wlan drivers are available on your pc or not.…

Read More

Hackerrank Cavity Map Solution

programming

This is the solution to the Cavity Map problem found in the the implementation section of the Algorithm domain in Hackerrank. The bellow solution is in Python2. In this you are given a square map of size n×n. Each cell of the map has a value denoting its depth. We will call a cell of the map a cavity if and only if this cell is not on the border of the map and each cell adjacent to it has strictly smaller depth. Two cells are adjacent if they have…

Read More

Hackerrank Utopian Tree Solution

This is the solution to the program in Hackerrank. This program can be found in the Algorithm Domain. Basically the Utopian Tree goes through 2 cycles of growth every year. The first growth cycle occurs during the spring, when it doubles in height. The second growth cycle occurs during the summer, when its height increases by 1 meter.  Screenshot The Code: #include<stdio.h>int main() { int t, n, a; scanf(“%d”, &t); while(t–) { a=1; scanf(“%d”, &n); for(int i=1; i<=n; i++) { if(i%2) a<<=1; else a++; } printf(“%dn”, a); } return 0;}…

Read More

Simple Factorial program for larger numbers

It is a totally different approach, we are just playing with double.As we know double has very large value 4.9e-324 to 1.8e+308.Then we convert the double into an integer array. Screenshot: OUTPUT The Code: #include<iostream>#include<stdlib.h>#include<math.h>using namespace std;/*Classic factorial function to find the factorial of a number using recursion method*/double factorial(int n){ if(n==1) return 1; else return (factorial(n-1)*n);}int main(){ int n; cout<<“factorial of: “; cin>>n; double r = factorial(n); double s = r; int i=0; /*to find the number of digits of the answer*/ for(i=0; r>=1; i++) { r /= 10;…

Read More

A simple program to check anagrams in java

programming

This is a simple program in Java. This program can be used to check if the two given strings are anagram. Two given strings are said to be anagrams when they have equal length and same characters are present in both the Strings. An example of anagram strings is SILENT and LISTEN! Screenshot Code import java.util.*; public class Anagram { public static boolean isAnagram(String s1, String s2) { if (s1.length() != s2.length()) { return false; } s1 = sortCharacters(s1); s2 = sortCharacters(s2); return s1.equals(s2); } public static String sortCharacters(String str)…

Read More

Merge sort using C

programming

This program illustrates the merge sort using c program. Merge sort uses merge algorithm and partition algorithm to sort the given array of unsorted elements. Partition algorithm separates each element, and merge algorithm combines every thing and shows up the sorted format of the array in increasing or decreasing format as wished, here it is in increasing format. Have a look at the sample output and code. Sample Output Code #include < stdio.h > #include < conio.h > void merge(int[], int, int, int); void partition(int[], int, int); int main() {…

Read More