Skip to content

Commit 99ed1be

Browse files
committed
- problem fixes
- longest NR substring - fixing two test cases - updating spring boot to 1.5.1 - removing redundant logback runtime dependencies
1 parent 1d7e614 commit 99ed1be

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

ProblemsStore/00000000000.xd

-46 Bytes
Binary file not shown.

build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext.kotlin_version = '1.0.6'
3-
ext.spring_version = '1.4.0.RELEASE'
3+
ext.spring_version = '1.5.1.RELEASE'
44

55
repositories {
66
mavenCentral()
@@ -16,7 +16,7 @@ plugins {
1616
}
1717

1818
apply plugin: 'kotlin'
19-
apply plugin: 'spring-boot'
19+
apply plugin: 'org.springframework.boot'
2020
apply from: "$rootDir/gradle/versioning.gradle"
2121

2222
group = 'jalgoarena'
@@ -44,9 +44,6 @@ dependencies {
4444
'org.jetbrains.xodus:xodus-openAPI:1.0.2',
4545
'org.jetbrains.xodus:xodus-entity-store:1.0.2'
4646

47-
runtime 'ch.qos.logback:logback-classic:1.1.7',
48-
'ch.qos.logback:logback-core:1.1.7'
49-
5047
testCompile 'junit:junit:4.12',
5148
"com.winterbe:expekt:0.5.0",
5249
"org.springframework.boot:spring-boot-starter-test"

gradle/versioning.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//noinspection GroovyAssignabilityCheck
22
version = new ProjectVersion(
3-
'1', '0', '19', System.env.TRAVIS_BUILD_NUMBER
3+
'1', '0', '20', System.env.TRAVIS_BUILD_NUMBER
44
)
55

66
println "Version number: " + version

problems.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{"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":[]}]},
6060
{"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}]},
6161
{"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}]},
6363
{"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}]}]},
6464
{"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}]},
6565
{"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

Comments
 (0)