File tree Expand file tree Collapse file tree 1 file changed +0
-39
lines changed
app/src/main/java/dev/gbenga/dsagithub/nav Expand file tree Collapse file tree 1 file changed +0
-39
lines changed Original file line number Diff line number Diff line change @@ -10,42 +10,3 @@ data object Home: Screen
1010
1111@Serializable
1212data class GithubDetails (val userData : User ? = null ): Screen
13-
14-
15- class Solution {
16- fun isValid (s : String ): Boolean {
17- val dict = mapOf<Char , Char >(' {' to ' }' , ' [' to ' ]' , ' (' to ' )' )
18- val stack = mutableListOf<Char >()
19-
20- s.forEach{
21- // dict[it]?.let{
22- // stack.add(it)
23- // }: stack.isEmpty() && dict[stack.pop()] != it false
24- if (dict[it] != null ){
25- stack.add(it)
26- }else {
27- if (stack.isNotEmpty() && dict[stack.pop()] != it){
28- return false
29- }
30- }
31- }
32- return stack.isNotEmpty()
33- }
34-
35- fun <T > MutableList<T>.pop (): T {
36- val lIndex = this .size - 1
37- val last = this [lIndex]
38- removeAt(lIndex)
39- return last
40- }
41-
42-
43- }
44-
45- // ())()()
46- /*
47- c += 2
48- find invalid
49- c = max(c, cm)
50-
51- */
You can’t perform that action at this time.
0 commit comments