|  | 
| 59 | 59 | {"id":"rev-level-order-traversal","title":"Reverse Level Order Traversal","description":"Given a binary tree, Write a method `levelorderRev ` to traverse the tree in the reversed level order manner. Return array of elements visited in reversed level order format.\n\n### Example\n\n ```\n     1\n    / \\\n   2   3     ==> 4567231\n  / \\ / \\\n 4  5 6  7 \n```","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"levelorderRev","returnStatement":{"type":"[I","comment":"Reverse level ordered array of binary tree elements"},"parameters":[{"name":"root","type":"com.jalgoarena.type.TreeNode","comment":"Root of binary tree"}]},"testCases":[{"input":[{"data":1,"left":{"data":2,"left":{"data":4},"right":{"data":5}},"right":{"data":3,"left":{"data":6},"right":{"data":7}}}],"output":[4,5,6,7,2,3,1]},{"input":[{"data":1,"left":{"data":2,"left":{"data":4}},"right":{"data":3,"right":{"data":7,"left":{"data":6}}}}],"output":[6,4,7,2,3,1]},{"input":[{"data":1,"left":{"data":2,"left":{"data":4}},"right":{"data":3,"right":{"data":7,"left":{"data":6,"left":{"data":7},"right":{"data":8}}}}}],"output":[7,8,6,4,7,2,3,1]},{"input":[{"data":1}],"output":[1]},{"input":[null],"output":[]}]}, | 
| 60 | 60 | {"id":"word-similarity","title":"Word Similarity - Edit Distance","description":"Edit distance is a classic algorithm that is used in many applications, including Spell Correction, DNA Sequencing and Natural Language Processing. Given two strings `a` and `b`, write a method - `editDistance` that returns the **minimum number of operations** needed to transform `a` into `b`. The following character operations are allowed:\n* Replace character\n* Insert character\n* Delete character\n\n### Examples\n\n```\n\"sale\", \"sales\" => 1\n\n1) Insert \"s\"\n```\n\n```\n\"sale\", \"sold\" => 2\n\n1) Replace \"a\" with \"o\"\n2) Replace \"e\" with \"d\"\n```\n\n```\n\"sa\", \"s\" => 1\n\n1) Delete \"a\"\n```","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"editDistance","returnStatement":{"type":"java.lang.Integer","comment":"Minimum number of operations"},"parameters":[{"name":"a","type":"java.lang.String","comment":"input string to be transformed"},{"name":"b","type":"java.lang.String","comment":"destination string"}]},"testCases":[{"input":["","a"],"output":1},{"input":[null,""],"output":0},{"input":["",null],"output":0},{"input":["",""],"output":0},{"input":[null,null],"output":0},{"input":["css","dll"],"output":3},{"input":["sale","sales"],"output":1},{"input":["sale","sold"],"output":2},{"input":["sa","s"],"output":1},{"input":["confusion","confusing"],"output":2},{"input":["abc","adef"],"output":3},{"input":["coding","code"],"output":3},{"input":["ATGCATGGCCAATTGCCAAT","ATCGATCGATCG"],"output":12},{"input":["ATGCATGGCCAAAATTTTAAAAATAGAGAGATTTCCCAATTGCCAAT","ATCGATCGATCGAATTA"],"output":32},{"input":["interview","intuition"],"output":5},{"input":["saturday","sunday"],"output":3}]}, | 
| 61 | 61 | {"id":"subset-summation","title":"Subset Summation","description":"Given an array of integers and a target number, determine if it is possible to choose a group of integers from the array, such that the numbers in the group sum to the given target.\n\n### Example\n\n* `[1,2,3,6,5], 10` -> `true`\n* `[1,2,3,6,5], 18` -> `false`","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"groupSum","returnStatement":{"type":"java.lang.Boolean","comment":"Is possible to find sum"},"parameters":[{"name":"numbers","type":"[I","comment":"An array of numbers","generic":null},{"name":"target","type":"java.lang.Integer","comment":"Target sum number","generic":null}]},"testCases":[{"input":[[2,7,11,15],9],"output":true},{"input":[[1,2,3,6,5],10],"output":true},{"input":[[1,2,3,6,5],18],"output":false},{"input":[[1,0,-1],2],"output":false},{"input":[[1,-3,-4],-2],"output":true},{"input":[[],1],"output":false},{"input":[[1,2,5,6,7,3,5,8,-33,-5,-72,12,-34,100,99],-64],"output":true},{"input":[[1,2,33,23,2423,33,23,1,7,6,8787,5,33,2,3,-23,-54,-67,100,400],390],"output":true},{"input":[[-1,-2,-3,-4,-5,-6,-100,-98,-111,-11],-70],"output":false}]}, | 
| 62 |  | -{"id":"longest-nr-substring-len","title":"Longest Non-Repeating Substring","description":"Given a `String` input, write a method `longestNRSubstringLen` to find the length of the longest `substring` that is made up of non-repeating characters.\n\n### Examples\n\n* `\"BCEFGHBCFG\"` -> `6` (\"CEFGHB\" or \"EFGHBC\")\n* `\"FFFFF\"` -> `1` (\"F\")\n* `\"aaabbbabcde\"` -> `5`","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"longestNRSubstringLen","returnStatement":{"type":"java.lang.Integer","comment":"Length of longest non-repeating substring"},"parameters":[{"name":"input","type":"java.lang.String","comment":"input string","generic":null}]},"testCases":[{"input":[""],"output":0},{"input":[null],"output":0},{"input":["abc"],"output":3},{"input":["AdSda"],"output":5},{"input":["BCEFGHBCFG"],"output":6},{"input":["FFFFF"],"output":1},{"input":["aaaabcdnha"],"output":6},{"input":["ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz{|}~"],"output":148}]}, | 
|  | 62 | +{"id":"longest-nr-substring-len","title":"Longest Non-Repeating Substring","description":"Given a `String` input, write a method `longestNRSubstringLen` to find the length of the longest `substring` that is made up of non-repeating characters.\n\n### Examples\n\n* `\"BCEFGHBCFG\"` -> `6` (\"CEFGHB\" or \"EFGHBC\")\n* `\"FFFFF\"` -> `1` (\"F\")\n* `\"aaabbbabcde\"` -> `5`","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"longestNRSubstringLen","returnStatement":{"type":"java.lang.Integer","comment":"Length of longest non-repeating substring"},"parameters":[{"name":"input","type":"java.lang.String","comment":"input string"}]},"testCases":[{"input":[""],"output":0},{"input":[null],"output":0},{"input":["abc"],"output":3},{"input":["adSda"],"output":3},{"input":["BCEFGHBCFG"],"output":6},{"input":["FFFFF"],"output":1},{"input":["aaaabcdnha"],"output":6},{"input":["ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz{|}~"],"output":96}]}, | 
| 63 | 63 | {"id":"insert-range","title":"Range Module - Inserting Ranges","description":"A Range Module is a module that tracks ranges of numbers. Range modules are used extensively when designing scalable online game maps with millions of players. \n\nYour task is to write a method - `insertRange` that takes in an `ArrayList` of sorted, non-overlapping integer `Interval's` (aka ranges) and a new `Interval` - insert, and returns an `ArrayList` of sorted `Interval's` where insert has been added to the `ArrayList` in the correct spot and the required overlapping ranges have been merged. Target a time complexity of O(n).\n\nNote: \n* [1,3] represents an interval that includes 1, 2 and 3.\n* Intervals should be sorted based on the value of start\n* The words Range and Interval are used interchangeably\n\n### Examples\n\n* ` [ [1,3], [7,10] ] & [2,6]` -> `[ [1,6], [7,10] ]`\n","timeLimit":1,"memoryLimit":32,"level":3,"func":{"name":"insertRange","returnStatement":{"type":"java.util.ArrayList","comment":"Array with inserted ranges","generic":"Interval"},"parameters":[{"name":"intervalsList","type":"java.util.ArrayList","comment":"sorted, non-overlapping list of Intervals","generic":"Interval"},{"name":"insert","type":"com.jalgoarena.type.Interval","comment":"interval to insert"}]},"testCases":[{"input":[[{"start":1,"end":3},{"start":7,"end":10}],{"start":2,"end":6}],"output":[{"start":1,"end":6},{"start":7,"end":10}]},{"input":[[{"start":-10,"end":-5},{"start":0,"end":10}],{"start":-2,"end":-1}],"output":[{"start":-10,"end":-5},{"start":-2,"end":-1},{"start":0,"end":10}]},{"input":[[{"start":-10,"end":-5},{"start":0,"end":10}],{"start":-5,"end":0}],"output":[{"start":-10,"end":10}]},{"input":[[{"start":0,"end":1},{"start":3,"end":4}],{"start":2,"end":10}],"output":[{"start":0,"end":1},{"start":2,"end":10}]},{"input":[[{"start":1,"end":2},{"start":3,"end":5},{"start":6,"end":7},{"start":8,"end":10},{"start":12,"end":14}],{"start":5,"end":9}],"output":[{"start":1,"end":2},{"start":3,"end":10},{"start":12,"end":14}]},{"input":[[{"start":0,"end":5}],{"start":1,"end":2}],"output":[{"start":0,"end":5}]},{"input":[[],{"start":1,"end":2}],"output":[{"start":1,"end":2}]},{"input":[[{"start":0,"end":1},{"start":4,"end":5}],{"start":2,"end":3}],"output":[{"start":0,"end":1},{"start":2,"end":3},{"start":4,"end":5}]}]}, | 
| 64 | 64 | {"id":"min-triangle-depth","title":"Minimum Triangle Depth","description":"Given a 'triangle' as an `ArrayList` of `ArrayList`'s of integers, with each list representing a level of the triangle, find the **minimum sum** achieved by following a top-down path and adding the integer at each level along the path. \n\nMovement is restricted to adjacent numbers from the top to the bottom.\n\nNotes:\n* you can traverse through adjacent nodes while moving up or down the triangle.\n* An adjacent node is defined as a node that is reached by moving down and left or down and right from a level. For example, in the triangle shown below, if you are at the digit 3 in the second row, its adjacent nodes are 5 and 6\n\n### Examples\n\n```\n[    [1],\n    [2,3],\n   [4,5,6],\n  [7,8,9,10]\n]\n\n=> 14 (1->2->4->7)\n```","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"minTriangleDepth","returnStatement":{"type":"java.lang.Integer","comment":"Minimum sum"},"parameters":[{"name":"input","type":"java.util.ArrayList","comment":"input triangle","generic":"ArrayList<Integer>"}]},"testCases":[{"input":[[[1],[2,3],[4,5,6],[7,8,9,10]]],"output":14},{"input":[[[1]]],"output":1},{"input":[[[]]],"output":0},{"input":[[[1],[1,0],[1,2,3],[7,2,3,1]]],"output":5},{"input":[[[1],[1,0],[1,2,3],[7,2,3,1],[5,6,7,3,2]]],"output":7},{"input":[[[1],[2,3],[4,5,6]]],"output":7},{"input":[[[1],[2,3]]],"output":3}]}, | 
| 65 | 65 | {"id":"distance-binary-tree","title":"Distance in a Binary Tree","description":"Given a binary tree and 2 integers that represents the `data` values of any two `TreeNode` present in the tree, write a method `getNodeDistance` that returns distance between the nodes. \n\nIf any of key does not exist in the tree, return -1. The **distance** between two nodes is defined as the minimum number of **edges** that must be traversed to travel between the two nodes.\n\n### Example\n\n ```\n     1\n    / \\\n   2   3     ==> getNodeDistance(2,7) => 3\n  / \\ / \\\n 4  5 6  7 \n```","timeLimit":1,"memoryLimit":32,"level":2,"func":{"name":"getNodeDistance","returnStatement":{"type":"java.lang.Integer","comment":"Distance between the nodes"},"parameters":[{"name":"root","type":"com.jalgoarena.type.TreeNode","comment":"Root of binary tree"},{"name":"n1","type":"java.lang.Integer","comment":"first node data"},{"name":"n2","type":"java.lang.Integer","comment":"second node data"}]},"testCases":[{"input":[{"data":1,"left":{"data":2,"left":{"data":4},"right":{"data":5}},"right":{"data":3,"left":{"data":6},"right":{"data":7}}},2,7],"output":3},{"input":[{"data":1,"left":{"data":2,"left":{"data":4},"right":{"data":5}},"right":{"data":3,"left":{"data":6},"right":{"data":7}}},4,6],"output":4},{"input":[{"data":1,"left":{"data":2,"left":{"data":4}},"right":{"data":3,"right":{"data":7,"left":{"data":6}}}},2,6],"output":4},{"input":[{"data":1,"left":{"data":2,"left":{"data":4}},"right":{"data":3,"right":{"data":7,"left":{"data":6}}}},2,5],"output":-1},{"input":[{"data":1},1,2],"output":-1},{"input":[null,1,2],"output":-1}]}, | 
|  | 
0 commit comments