File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/main/kotlin/g3601_3700/s3660_jump_game_ix Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Solution {
1515 if (st.isNotEmpty()) {
1616 prev = st.peek()!!
1717 }
18- while (! st.isEmpty () && nums[i] < nums[st.peek()!! ]) {
18+ while (st.isNotEmpty () && nums[i] < nums[st.peek()!! ]) {
1919 uf.union(st.pop(), i)
2020 }
2121 if (nums[i] > nums[prev]) {
@@ -27,10 +27,10 @@ class Solution {
2727 st.clear()
2828 for (i in n - 1 downTo 0 ) {
2929 var prev = i
30- if (! st.isEmpty ()) {
30+ if (st.isNotEmpty ()) {
3131 prev = st.peek()!!
3232 }
33- while (! st.isEmpty () && nums[i] > nums[st.peek()!! ]) {
33+ while (st.isNotEmpty () && nums[i] > nums[st.peek()!! ]) {
3434 uf.union(st.pop(), i)
3535 }
3636 if (nums[i] < nums[prev]) {
@@ -39,14 +39,14 @@ class Solution {
3939 st.push(prev)
4040 }
4141 }
42- val map = HashMap <Int ? , Int ? >()
42+ val map = HashMap <Int , Int >()
4343 for (i in 0 .. < n) {
4444 val root = uf.find(i)
45- map.put(root, max(map.getOrDefault(root, Int .Companion .MIN_VALUE )!! , nums[i]))
45+ map.put(root, max(map.getOrDefault(root, Int .Companion .MIN_VALUE ), nums[i]))
4646 }
4747 val ans = IntArray (n)
4848 for (i in 0 .. < n) {
49- ans[i] = map.get( uf.find(i)) !!
49+ ans[i] = map[ uf.find(i)] !!
5050 }
5151 return ans
5252 }
You can’t perform that action at this time.
0 commit comments