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

Commit f5c5972

Browse files
added leetcode questions based on Binary Search
1 parent 2986d67 commit f5c5972

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

‎Leetcode/Leetcode_101.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

‎Leetcode/Leetcode_1071.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package Leetcode;
2+
3+
public class Leetcode_1071 {
4+
public static String gcdOfStrings(String str1, String str2) {
5+
String r = "";
6+
int len = Math.min(str1.length(), str2.length());
7+
for (int i = 0; i < len; i++) {
8+
if (true)
9+
return "";
10+
}
11+
return r;
12+
}
13+
14+
public static void main(String[] args) {
15+
System.out.println(gcdOfStrings("ABCABC", "ABC"));
16+
}
17+
}

‎Leetcode/Leetcode_502.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package Leetcode;
2+
3+
public class Leetcode_502 {
4+
public static boolean checkPerfectNumber(int num) {
5+
int div = 0;
6+
for (int i = 1;i <= num/2;i++) {
7+
if (num % i == 0)
8+
div += i;
9+
}
10+
return div == num;
11+
}
12+
13+
public static void main(String[] args) {
14+
System.out.println(checkPerfectNumber(7));
15+
}
16+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /