We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8070153 commit da8d919Copy full SHA for da8d919
src/main/kotlin/g1701_1800/s1713_minimum_operations_to_make_a_subsequence/Solution.kt
@@ -3,6 +3,8 @@ package g1701_1800.s1713_minimum_operations_to_make_a_subsequence
3
// #Hard #Array #Hash_Table #Greedy #Binary_Search
4
// #2023_06_16_Time_862_ms_(100.00%)_Space_67.3_MB_(100.00%)
5
6
+import java.util.Arrays
7
+
8
class Solution {
9
fun minOperations(target: IntArray, arr: IntArray): Int {
10
val map: MutableMap<Int, Int> = HashMap()
@@ -23,7 +25,7 @@ class Solution {
23
25
var l = 0
24
26
val arr = IntArray(n)
27
for (num in list) {
- var index = arr.binarySearch(0, l, num!!)
28
+ var index = Arrays.binarySearch(arr, 0, l, num!!)
29
if (index < 0) {
30
index = index.inv()
31
}
0 commit comments