Skip to content

Instantly share code, notes, and snippets.

View computingfreak's full-sized avatar

Milind Shah computingfreak

View GitHub Profile
import java.util.HashMap;
public class Number2Word {
static final HashMap<Character,String> mapping = new HashMap<Character,String>(){{
put('1', "");
put('2',"abc");
put('3',"def");
put('4',"ghi");
put('5',"jkl");
put('6',"mno");
put('7',"pqrs");
mapping = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz',
}
@computingfreak
computingfreak / TowersOfHanoiStack.java
Created March 29, 2018 04:00
Towers Of Hanoi Stack
import java.util.Scanner;
public class TowersOfHanoiStack
{
public static int flag=0;
static class Stack
{
public int STACKSIZE=10;
public int top;
public int items[];
public Stack()
@computingfreak
computingfreak / TowersOfHanoiLinkedList.java
Created March 29, 2018 03:59
Towers Of Hanoi LinkedList
import java.util.Scanner;
//A Disk with a value , which is an element of the stack , tower in this case and a next disk pinter reference
class Disk
{
int value;
Disk next;
}
//A Stack data structure representing a tower
class Tower
@computingfreak
computingfreak / TowersOfHanoiDisplay.java
Created March 29, 2018 03:45
Towers Of Hanoi Display Ring Transfer
import java.io.*;
public class TowersOfHanoiDisplay
{
static int flag=0;
public static void main()throws IOException
{
TowersOfHanoiDisplay obj=new TowersOfHanoiDisplay();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter number of rings");
int N=Integer.parseInt(br.readLine());
@computingfreak
computingfreak / TowersOfHanoiArray.java
Created March 29, 2018 03:44
Towers Of Hanoi Array
import java.util.Scanner;
public class TowersOfHanoiArray
{
public static int N;
public static int towerA[];
public static int towerB[];
public static int towerC[];
public static void main()
{
TowersOfHanoiArray toha=new TowersOfHanoiArray();
@computingfreak
computingfreak / TowersOfHanoiRecursive.java
Created March 29, 2018 03:43
Towers Of Hanoi Recursive
/**The Tower of Hanoi or Towers of Hanoi is a mathematical game or puzzle.
* It consists of three rods, and a number of disks of different sizes which can slide onto any rod.
* The puzzle starts with the disks neatly stacked in order of size on one rod, the smallest at the top,
* thus making a conical section.
* The objective of the puzzle is to move the entire stack to another rod, obeying the following rules:
* Only one disk may be moved at a time.
* Each move consists of taking the upper disk from one of the rods and sliding it onto another rod,
* on top of the other disks that may already be present on that rod.
* No disk may be placed on top of a smaller disk.**/
import java.io.*;
private long getHighestIndexOfStoredImages(String dirName, Long userId) throws LogicException {
Path targetDir = Paths.get(dirName);
long highestIndex = 0;// actual sequence number starts from 1
try {
DirectoryStream<Path> stream = Files.newDirectoryStream(targetDir,
userId + "_*_*.{JPG,JPEG,PNG,jpg,jpeg,png}");
for (Path imageFiles : stream) {
String fileName = imageFiles.getFileName().toString();
long fileIndex = Long
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.security.*;
public class md5 {
public static void main(String[] args) throws Exception {
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.security.*;
public class sha256 {
public static void main(String[] args) throws Exception{