Posts

Hackerrank Modified Kaprekar Numbers Solution

Image
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 sendKap(x,s): y=x*x y=str(y) s1=y[:len(y)/2:] s2=y[len(y)/2::] s3=int(s1)+int(s2) if(s3==x): s.append(str(x)) st=input() en=input() s=[] for i in range(st,en+1): if(i>9): sendKap(i,s) elif(i==1): s.append(str(i)) elif(i==9): s.append(str(i)) if(len(s)==0): print 'INVALID RANGE' else: print ' '.join(s) Got any problems feel free to comment them here !

My First webpage using Bootstrap Framework

Image
In this post you will learn to create your first webpage using Bootstrap Framework. Bootstrap framework is a responsive framework. It automatically adjust the site's layout according to the device in which it is viewed. Responsiveness is given highest priority now a days. This webpage using Bootstrap Framework uses basic components. Designing webpage using Bootstrap Framework is easy and need to less few lines of code. Components used Containers Jumbotron Well Panels You can view the demo of the  webpage using Bootstrap Framework by clicking here . 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 Bootstrap</h4> </div> </div> <div class="container"> <div class="row"> <div

Accepting input from console in Node.Js

Image
In this post, we will demonstrate how to accept input and perform operation in node.js from a console. Node.js is an open-source, cross-platform runtime environment for developing server-side web applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux, FreeBSD, NonStop, IBM AIX, IBM System z and IBM i. Screenshot: The Code var readline = require('readline'); var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question("What is your name ? ", function(answer) { // TODO: Log the answer in a database console.log("Hello "+answer+" how are u ?"); rl.close(); }); Got any doubts, just go ahead and comment them ! :)

Bit Stuffing Code Implementation in Java

Image
This is an implementation of the Bit Stuffing popularly used in data communication, also known as one of the concepts of Framing data bits. To know more please  click here. Sample Output: This is a sample output with data binary data entered as 11001111110. Program Code: import java.util.*; public class BitStuffing { public static void main(String[] args) { System.out.print("Enter the Binary message: "); Scanner sn=new Scanner(System.in); String data = sn.nextLine(); String res = new String(); String out=new String(); int counter = 0; for(int i=0;i<data.length();i++) { if (data.charAt(i)!='1' && data.charAt(i)!='0') { System.out.println("Enter only Binary values!!!"); return; }

How to create a WIFI WLAN Hotspot in your Laptop.

Image
Sometime we wanna create a wifi hotspot while we have connected a donggle or wired broadband connection. We use some third party software like virtual hotspot. But here we  DON'T NEED ANY THIRD PARTY SOFTWARES. Screenshots: The command window In mobile show - Wifi hotspot successfully created In mobile - Entering the password In mobile shows - Connected to your PC. The commands: We have to run the cmd as a administration. First check weather wlan drivers are available on your pc or not. C:\Windows\system32> netsh wlan show drivers Now we configure the hotspot. We will give the username and password C:\Windows\system32> netsh wlan set hostednetwork mode=allow ssid=Tejas-PC key=dubaramatpuchna Now we on the hostednetwork or hotspot . C:\Windows\system32> netsh wlan start hostednetwork After using the wifi to turn off the hotspot give command. C:\Windows\system32> netsh wlan stop hostednetwork C:\Windows\system32&g

How to make your Pendrive Bootable.

Image
We all have done, installed operating systems using ordinary CD and DVD, and we also have done using Bootable Pendrives somewhere. But here we'll see how make a Pendrive to a Bootable Pendrive without using any third party software. DOS give the power to make your Pendrive Bootable using some commands . Screenshots: Copy all the required files from the folder where you've stored the OS Files and paste in the Pendrive. See here the removable Pendrive is Bootable now. DOS Commands: Open the command window as Administration. First we have to use the Diskpart command.   diskpart Now we can see all the volumes by using list disk command list disk Now we have to select the disk where we have to paste all the OS Files select disk x Where x = 1,2,3 (Your disk number which one you want to make bootable) Now we clean the disk clean Now we have to create a primary partition and Active the disk . create primary partition create partition primary

Hackerrank Cavity Map Solution

Image
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 a common side (edge). You need to find all the cavities on the map and depict them with the uppercase character X. Screenshot: The Code: def mapCavity(arr, n): for i in range(1, n-1): for j in range(1, n-1): if arr[i-1][j] != 'X' and int(arr[i-1][j]) < int(arr[i][j]) and \ arr[i+1][j] != 'X' and int(arr[i+1][j]) < int(arr[i][j]) and \ arr[i][j-1] != 'X' and int(arr[i][j-1]) < int(arr[i][j]) and \ arr[i][j+1] != 'X' and