This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapping = { | |
'2': 'abc', | |
'3': 'def', | |
'4': 'ghi', | |
'5': 'jkl', | |
'6': 'mno', | |
'7': 'pqrs', | |
'8': 'tuv', | |
'9': 'wxyz', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**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.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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{ |