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
| class Solution { | |
| public int maxArea(int[] height) { | |
| int i = 0; | |
| int j = height.length - 1; | |
| int max = Integer.MIN_VALUE; | |
| while (i < height.length && j > 0 && i < j) { |
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 com.primeholding.training.create; | |
| import java.util.LinkedList; | |
| public class CustomHashMap<K, V> { | |
| LinkedList<Pair<K, V>>[] storage = new LinkedList[10]; | |
| public void put(K key, V value) { | |
| int val = key.hashCode(); |
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
| class Solution { | |
| public boolean makesquare(int[] nums) { | |
| // less than 4 sticks, false | |
| if(nums.length < 4) { | |
| return false; | |
| } | |
| // find total | |
| int total = 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
| class Solution { | |
| public List<List<Integer>> combinationSum(int[] candidates, int target) { | |
| List<List<Integer>> result = new ArrayList<>(); | |
| _combine(0, candidates, new ArrayList<>(), target, result); | |
| return result; | |
| } | |
| void _combine(int idx, int[] src, List<Integer> current, int target, List<List<Integer>> 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
| static Set<TreeNode> findLeafDistanceNodes(TreeNode<Integer> node, int distance) { | |
| Set<TreeNode> result = new HashSet<>(); | |
| _findLeafDistanceNodes(node, new ArrayList<>(), result, distance); | |
| return result; | |
| } | |
| static void _findLeafDistanceNodes(TreeNode<Integer> node, List<TreeNode> current, Set<TreeNode> result, int lvl) { | |
| if(node == null) { | |
| return; |
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 com.primeholding.training.codility.attempt2.live; | |
| import java.util.HashMap; | |
| import java.util.HashSet; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.Set; | |
| import java.util.TreeSet; | |
| public class Task { | |
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 com.primeholding.training.dp; | |
| import java.util.HashMap; | |
| public class PossibleSumsDP { | |
| public static void main(String[] args) { | |
| int[] src = {1, 2, 4, 5, 10, 15, 16}; |
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 com.primeholding.training.dp; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| public class ClimbingStairs { | |
| public static void main(String[] args) { | |
| int res = climbStairs(4); | |
| System.out.println(res); |
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 com.primeholding.training; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.apache.commons.lang3.StringUtils; | |
| import org.springframework.security.core.parameters.P; | |
| public class StringPermutation { | |
| public static void main(String[] args) { |
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 com.primeholding.training; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.Collections; | |
| import java.util.List; | |
| public class IntegerPermutations { | |
| public static void main(String[] args) { |