File tree 2 files changed +6
-6
lines changed
solution/1900-1999/1993.Operations on Tree
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -9,23 +9,23 @@ class LockingTree {
9
9
children[parent[i]].push_back (i);
10
10
}
11
11
}
12
-
12
+
13
13
bool lock (int num, int user) {
14
14
if (locked[num] == -1 ) {
15
15
locked[num] = user;
16
16
return true ;
17
17
}
18
18
return false ;
19
19
}
20
-
20
+
21
21
bool unlock (int num, int user) {
22
22
if (locked[num] == user) {
23
23
locked[num] = -1 ;
24
24
return true ;
25
25
}
26
26
return false ;
27
27
}
28
-
28
+
29
29
bool upgrade (int num, int user) {
30
30
int x = num;
31
31
while (x != -1 ) {
Original file line number Diff line number Diff line change @@ -14,23 +14,23 @@ public LockingTree(int[] parent) {
14
14
children [parent [i ]].add (i );
15
15
}
16
16
}
17
-
17
+
18
18
public boolean lock (int num , int user ) {
19
19
if (locked [num ] == -1 ) {
20
20
locked [num ] = user ;
21
21
return true ;
22
22
}
23
23
return false ;
24
24
}
25
-
25
+
26
26
public boolean unlock (int num , int user ) {
27
27
if (locked [num ] == user ) {
28
28
locked [num ] = -1 ;
29
29
return true ;
30
30
}
31
31
return false ;
32
32
}
33
-
33
+
34
34
public boolean upgrade (int num , int user ) {
35
35
int x = num ;
36
36
while (x != -1 ) {
You can’t perform that action at this time.
0 commit comments