Skip to content

Instantly share code, notes, and snippets.

View agrawal-priyank's full-sized avatar

Priyank agrawal-priyank

  • New York
View GitHub Profile
@agrawal-priyank
agrawal-priyank / BooleanParenthesizaton.java
Created November 13, 2017 02:30
Boolean Parenthesizaton by Dynamic Programming
class BooleanParenthesizaton {
public static void main (String args[]) {
char[] symbol = {'T', 'T', 'F', 'T'};
har[] operator = {'|', '&', '^'};
BooleanParenthesizaton bP = new BooleanParenthesizaton();
System.out.println(bP.countWaysToParenthesize(symbol, operator));
}
public int countWaysToParenthesize(char[] symbol, char[] operator) {
@agrawal-priyank
agrawal-priyank / SearchPathOfAWordInMatrix.java
Last active October 29, 2017 04:20
Search path of a word in a matrix
public class WordPath{
class Coordinate{
public int x;
public int y;
public Coordinate(int x, int y){
this.x = x;
this.y = y;
}
}
@agrawal-priyank
agrawal-priyank / Calculator.java
Created October 11, 2017 00:36
Evaluate an Arithmetic expression using Stacks in Java.
import java.util.Stack;
public class Calculator {
public enum Operator{ADD, SUBTRACT, MULTIPLY, DIVIDE, BLANK}
public static void main(String[] args){
String expression = "2-6-7*8/2+5";
Calculator calc = new Calculator();
System.out.println(calc.compute(expression));