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
// Array of constructors for the all registered stores | |
var registeredStores = [], // List of registered store constructors | |
registeredStoreNames = [], // StoreNames | |
registeredActions = {}; // Set of registered actionNames | |
// Keep the register functions in a closure so that | |
// there is only one instance of this function irrespective | |
// of the number of components the mixin is applied to | |
function registerStore (store) { | |
var self = this, |
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
//This Program is to find out whether String contains all the unique characters | |
//With out using any additional data structures | |
public class UniqueCharString { | |
private String ip; | |
public UniqueCharString(String ip) { | |
this.ip = ip; | |
} | |
// method 1 : When characters are not ASCII but could be anything alphabets |
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 Print2DArrayInSpiral { | |
public int arrA[][] = { { 1, 2, 3, 4, 5 }, { 18, 19, 20, 21, 6 }, | |
{ 17, 28, 29, 22, 7 }, { 16, 27, 30, 23, 8 }, | |
{ 15, 26, 25, 24, 9 }, { 14, 13, 12, 11, 10 } }; | |
public int printSpiral(int row_S, int row_E, int col_S, int col_E, | |
boolean reverse, boolean rowPrint) { | |
if (row_S > row_E && col_S > col_E) { |
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 LongestPrefixSequence { | |
private String[] arrA; | |
public LongestPrefixSequence(String[] arrA) { | |
this.arrA = arrA; | |
} | |
public String findPrefix() { | |
int resultLen = arrA[0].length(); | |
int curr; |
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 RotatedArray { | |
public boolean isRotated(String s1, String s2){ | |
if(s1.length()!=s2.length()){ | |
return false; | |
} | |
String sAdd = s1 + s1; | |
if(sAdd.contains(s2)){ | |
return true; | |
}else{ | |
return false; |
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.Stack; | |
public class PreOrderTree { | |
public void preOrderRecursive(Node root) { | |
if (root != null) { | |
System.out.print(root.data + " "); | |
preOrderRecursive(root.left); | |
preOrderRecursive(root.right); | |
} | |
} |
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 T_InorderIteration; | |
import java.util.Stack; | |
public class InorderIretation { | |
public void inorderRecursive(Node root) { | |
if (root != null) { | |
inorderRecursive(root.left); | |
System.out.print(root.data + " "); | |
inorderRecursive(root.right); |
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 T_PostOrder; | |
import java.util.Stack; | |
public class PostorderTree { | |
public void postOrderRecursive(Node root) { | |
if (root != null) { | |
postOrderRecursive(root.left); | |
postOrderRecursive(root.right); |
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
var Grandparent = React.createClass({ | |
childContextTypes: { | |
foo: React.PropTypes.string.isRequired | |
}, | |
getChildContext: function() { | |
return { foo: "I m the grandparent" }; | |
}, |
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.Comparator; | |
import java.util.PriorityQueue; | |
public class MaxRevenueTickets { | |
PriorityQueue<Integer> pq; | |
// we will create a max heap | |
public MaxRevenueTickets(int length) { | |
pq = new PriorityQueue<>(length, new Comparator<Integer>() { |
OlderNewer