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

Commit555f2ec

Browse files
refactor 1375
1 parentd9e1dd0 commit555f2ec

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

‎src/main/java/com/fishercoder/solutions/_1375.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
packagecom.fishercoder.solutions;
22

3-
/**
4-
* 1375. Bulb Switcher III
5-
*
6-
* There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all the bulbs are turned off.
7-
* At moment k (for k from 0 to n - 1), we turn on the light[k] bulb. A bulb change color to blue only if it is on and all the previous bulbs (to the left) are turned on too.
8-
* Return the number of moments in which all turned on bulbs are blue.
9-
*
10-
* Example 1:
11-
* Input: light = [2,1,3,5,4]
12-
* Output: 3
13-
* Explanation: All bulbs turned on, are blue at the moment 1, 2 and 4.
14-
*
15-
* Example 2:
16-
* Input: light = [3,2,4,1,5]
17-
* Output: 2
18-
* Explanation: All bulbs turned on, are blue at the moment 3, and 4 (index-0).
19-
*
20-
* Example 3:
21-
* Input: light = [4,1,2,3]
22-
* Output: 1
23-
* Explanation: All bulbs turned on, are blue at the moment 3 (index-0).
24-
* Bulb 4th changes to blue at the moment 3.
25-
*
26-
* Example 4:
27-
* Input: light = [2,1,4,3,6,5]
28-
* Output: 3
29-
*
30-
* Example 5:
31-
* Input: light = [1,2,3,4,5,6]
32-
* Output: 6
33-
*
34-
* Constraints:
35-
* n == light.length
36-
* 1 <= n <= 5 * 10^4
37-
* light is a permutation of [1, 2, ..., n]
38-
* */
393
publicclass_1375 {
404
publicstaticclassSolution1 {
415
publicintnumTimesAllBlue(int[]light) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp