This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| Counter c = new Counter(); | |
| int[] coins = {1, 5, 10, 25}; | |
| money(coins, 0, 100, c); | |
| System.out.println(c.c); | |
| } |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| ArrayDeque<Character> sb = new ArrayDeque<Character>(); | |
| printBrackets(10, 0, 0, sb); | |
| } | |
| public static void printBrackets(int n, int l, int r, ArrayDeque<Character> sb) { | |
| if(l + r == 2 * n) { |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| String s = "abc"; | |
| permutation(0, s); | |
| } | |
| public static void permutation(int index, String s) { | |
| // check null |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| int[] a = {1, 2, 3}; | |
| LinkedList<Integer> sub = new LinkedList<Integer>(); | |
| subset(a, 0, sub); | |
| } |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| Counter c = new Counter(); | |
| Board b = new Board(10, 10); | |
| Point s = b.getPoint(0, 0); | |
| Point d = b.getPoint(2, 2); | |
| // no limited points |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| Counter c = new Counter(); | |
| hop(c, 5); | |
| System.out.println(c.c); | |
| } | |
| public static void hop(Counter c, int n) { |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| int[] a = {0, 1, 2, 3, 4, 6, 7, 8}; | |
| System.out.println(find(a, 8)); | |
| } | |
| public static int find(int[] a, int n) { | |
| for(int i = 0; i <=n; i++) { |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| System.out.println(flip(0, 1)); | |
| } | |
| public static int flip(int a, int b) { | |
| int r = a ^ b; | |
| int c = 0 ; |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| System.out.println(convert(0.8125)); | |
| } | |
| // put m in n starting from ith to jth index | |
| public static String convert(double x) { |
This file contains hidden or 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.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| System.out.println(insert(5, 16, 10, 18)); | |
| } | |
| // put m in n starting from ith to jth index | |
| public static String insert(int m, int n, int i, int j) { |
NewerOlder