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
public class MissingNumber { | |
public static void main(String[] args) { | |
MissingNumber missingNum = new MissingNumber(); | |
System.out.println("Missing Number : " + missingNum.findMissingNum(new int[] {3,1,2,5,4,7,9,8}, 9)); | |
} | |
private int findMissingNum(int[] intArray, int n) { | |
int res = 0; | |
int sum = 0; |
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
public class MissingNumbers { | |
public static void main(String[] args) { | |
//In the below code: Array Size = 8 and n = 10. | |
//So 2 missing numbers! | |
int n = 10; | |
int[] intArr = new int[] {3,1,2,5,4,7,10,8}; | |
MissingNumbers missingNums = new MissingNumbers(); | |
int[] missingNums = missingNums.findMissingNumber(intArr, n); | |
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
@Scope(ScopeType.STATELESS) | |
@BypassInterceptors | |
@Install(precedence = Install.APPLICATION, dependencies = "org.jboss.seam.security.identity") | |
@Name("org.jboss.seam.core.resourceLoader") | |
public class DatabaseResourceLoader extends ResourceLoader { | |
@Override | |
public ResourceBundle loadBundle(String bundleName) { | |
return new ResourceBundle() { | |
public Enumeration<String> getKeys() { | |
//Locale locale = org.jboss.seam.core.Locale.instance(); |
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
public class SpiralWalking { | |
public static void main(String[] args) { | |
SpiralWalking sw = new SpiralWalking(); | |
String res[][] = sw.walkSpirally(10,10); | |
for(int i=0;i<10;i++) { | |
System.out.println(); | |
for(int j=0;j<10;j++) { | |
System.out.print(res[i][j] + " "); | |
} |
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 com.google.caliper.Param; | |
import com.google.caliper.Runner; | |
import com.google.caliper.SimpleBenchmark; | |
import java.util.HashMap; | |
/** | |
* Simple Caliper Benchmark test program. | |
* | |
* @author Babji Prashanth, Chetty | |
*/ |
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.IOException; | |
/** | |
* Simple Java program to execute Mac-OS command (For Ex: To open a Finder Window) through a Java program. | |
* | |
* @author Babji, Chetty | |
*/ | |
public class Run { | |
public static void main(String[] params) throws IOException { | |
Runtime.getRuntime().exec(new String[] {"open", params[0]}); |
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
package com.bchetty.gcj2014; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* GCJ 2014 - Magic Trick Problem | |
* | |
* @author Babji, Chetty | |
*/ |
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
package com.bchetty.gcj2014; | |
import java.util.Iterator; | |
import java.util.TreeSet; | |
/** | |
* GCJ 2014 - 'Deceitful War' problem solution | |
* | |
* @author Babji, Chetty | |
*/ |
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
** | |
* Inception | |
* | |
* @author Babji, Chetty | |
*/ | |
public class Inception { | |
public static void main(String[] args) { | |
Inception inception = new Inception(); | |
inception.dream(0); | |
} |