Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9ca7e7

Browse files
authored
Improved tasks 385, 398
1 parent5c0673d commitb9ca7e7

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

‎src/main/java/g0301_0400/s0385_mini_parser/Solution.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@
44

55
importcom_github_leetcode.NestedInteger;
66

7+
/*
8+
* // This is the interface that allows for creating nested lists.
9+
* // You should not implement it, or speculate about its implementation
10+
* public interface NestedInteger {
11+
* // Constructor initializes an empty nested list.
12+
* public NestedInteger();
13+
*
14+
* // Constructor initializes a single integer.
15+
* public NestedInteger(int value);
16+
*
17+
* // @return true if this NestedInteger holds a single integer, rather than a nested list.
18+
* public boolean isInteger();
19+
*
20+
* // @return the single integer that this NestedInteger holds, if it holds a single integer
21+
* // Return null if this NestedInteger holds a nested list
22+
* public Integer getInteger();
23+
*
24+
* // Set this NestedInteger to hold a single integer.
25+
* public void setInteger(int value);
26+
*
27+
* // Set this NestedInteger to hold a nested list and adds a nested integer to it.
28+
* public void add(NestedInteger ni);
29+
*
30+
* // @return the nested list that this NestedInteger holds, if it holds a nested list
31+
* // Return empty list if this NestedInteger holds a single integer
32+
* public List<NestedInteger> getList();
33+
* }
34+
*/
735
publicclassSolution {
836
privateinti =0;
937

‎src/main/java/g0301_0400/s0398_random_pick_index/Solution.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ public int pick(int target) {
2828
returnlist.get(rand.nextInt(list.size()));
2929
}
3030
}
31+
/*
32+
* Your Solution object will be instantiated and called as such:
33+
* Solution obj = new Solution(nums);
34+
* int param_1 = obj.pick(target);
35+
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp