FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithm/Week_04/id_27/LeetCode_784_027.java at master · feixiangcode/algorithm · GitHub
feixiangcode
/
algorithm
Public
forked from
algorithm001/algorithm
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithm
/
Week_04
/
id_27
/
LeetCode_784_027.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (30 loc) · 907 Bytes
Breadcrumbs
algorithm
/
Week_04
/
id_27
/
LeetCode_784_027.java
Copy path
File metadata and controls
38 lines (30 loc) · 907 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class
Solution
{
private
List
<
String
>
result
=
new
ArrayList
<>();
public
List
<
String
>
letterCasePermutation
(
String
S
) {
findCombination
(
S
.
toCharArray
(),
0
,
""
);
return
result
;
}
private
void
findCombination
(
char
[]
data
,
int
index
,
String
str
) {
if
(
index
==
data
.
length
) {
result
.
add
(
str
);
return
;
}
Character
c
=
data
[
index
];
if
(
Character
.
isDigit
(
c
)) {
String
str1
=
str
+
c
;
findCombination
(
data
,
index
+
1
,
str1
);
}
else
{
String
str2
=
str
+
Character
.
toUpperCase
(
c
);
findCombination
(
data
,
index
+
1
,
str2
);
String
str3
=
str
+
Character
.
toLowerCase
(
c
);
findCombination
(
data
,
index
+
1
,
str3
);
}
return
;
}
public
static
void
main
(
String
[]
args
) {
System
.
out
.
println
(
new
Solution
().
letterCasePermutation
(
"a1b2"
));
System
.
out
.
println
(
new
Solution
().
letterCasePermutation
(
"3z4"
));
System
.
out
.
println
(
new
Solution
().
letterCasePermutation
(
"12345"
));
}
}
Back
|
FazBrowse Home
|
New Git URL