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.HashMap; | |
| import java.util.Map; | |
| /** | |
| * Created by sudharti on 10/30/17. | |
| */ | |
| public class BudgetShopping { | |
| static int budgetShopping(int n, int[] bundleQuantities, int[] bundleCosts) { | |
| return budgetShopping(n, bundleQuantities, bundleCosts, new HashMap<>()); | |
| } |
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
| package matrix; | |
| import java.util.Arrays; | |
| import java.util.Scanner; | |
| /** | |
| * TicTacToeGame | |
| */ | |
| public class TicTacToeGame { |
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
| def findSchedules(workHours, dayHours, pattern): | |
| totalHours = 0 | |
| result = [] | |
| for c in pattern: | |
| if c != '?': | |
| totalHours = totalHours + int(c) | |
| diff = workHours - totalHours | |
| constructResult(list(pattern), 0, diff, dayHours, result) | |
| return result |
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
| public static SinglyLinkedListNode removeNodes(SinglyLinkedListNode listHead, int x) { | |
| SinglyLinkedListNode head = null, tail = null; | |
| while (listHead != null) { | |
| if (listHead.data <= x) { | |
| SinglyLinkedListNode node = new SinglyLinkedListNode(); | |
| node.data = listHead.data; | |
| if(head == null) { | |
| head = tail = node; | |
| } else { | |
| tail.next = node; |
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
| public static int isPrime(int x) { | |
| if(x <= 2) return 1; | |
| int num = 2, k = 0, sqrt = (int) Math.sqrt(x); | |
| boolean[] arr = new boolean[x-1]; | |
| while(num <= sqrt) { | |
| if(arr[num-2]) { | |
| num++; | |
| continue; | |
| } |
OlderNewer