Skip to content

Instantly share code, notes, and snippets.

import java.util.HashMap;
public class Q9_11 {
public static int f(String exp,boolean result,int expstart, int expend, HashMap<String,Integer> q){
String key = "" + result + expstart + expend;
int c = 0;
if(q.containsKey(key)){
import java.util.HashMap;
import java.util.LinkedList;
public class Q9_10 {
public static void main(String[] args){
Box[] boxes = new Box[]{new Box(3,4,1),new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2), new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6, 2),new Box(7, 8, 3),new Box(3, 4, 1), new Box(8, 6,
import java.util.ArrayList;
public class Q9_9 {
// static int cnt = 0;
static int GRID_SIZE = 8;
public static void placeQueens(int row, Integer[] columns, ArrayList<Integer[]> results){
if (row == GRID_SIZE){
import java.util.Random;
public class Q9_7 {
public static void Paintfil(char[][] screen, int x, int y, char newcolor, char oldcolor){
if(x < 0 || x > screen[0].length-1 ||
import java.util.ArrayList;
public class Q9_6 {
public void addParen(ArrayList<String> list,int left, int right, char[] str, int cnt){
if(left < 0 || right < left) return;
if(right == 0 && left == 0){
import java.util.ArrayList;
public class Q_9_5 {
public static ArrayList<String> permutation(String instring){
if(instring == null){
return null;
}
import java.util.Arrays;
public class Q_3 {
public static int magicBS(int[] array, int start, int end){
if(end < start || start <0 || end >= array.length){
return -1;
public class Q9_2 {
public static int FindPath(int[] dst){
int x = dst[0];
int y = dst[1];
if(x==0 && y==0){
return 0;
}
public class Q9_1 {
public static void main(String[] args){
int test = 10;
System.out.println("Total Stair No.: "+test);
int[] maptest = new int [test];
for (int i=0;i < maptest.length;i++){
maptest[i] = -1;
public class Q5_8 {
public void drawHLine(byte[] screen, int width, int x1, int x2, int y) {
int height = screen.length / (width / 8);
if(y < 0 || y >= height || x1<0 || x2 <0 || x1 > screen.length * 8 || x2 > screen.length * 8)
{
return;
}
int idx = y*(width/8);
int idx1 = idx + (x1/8);