Skip to content

Commit a8533e4

Browse files
committed
Add SRM 627
1 parent 4a45990 commit a8533e4

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class ManySquares {
2+
3+
public int howManySquares(int[] sticks) {
4+
int[] num = new int[1001];
5+
for (int i = 0; i < sticks.length; i++)
6+
num[sticks[i]]++;
7+
int result = 0;
8+
for (int i = 0; i < num.length; i++)
9+
result += num[i] / 4;
10+
return result;
11+
}
12+
13+
}

TopCoder/SRMs/SRM627/Div2_250_howManySquares/README.md

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class HappyLetterDiv2 {
2+
3+
public char getHappyLetter(String letters) {
4+
int[] appears = new int[26];
5+
for (int i = 0; i < letters.length(); i++)
6+
appears[letters.charAt(i) - 'a']++;
7+
for (int i = 0; i < 26; i++)
8+
if (appears[i] > letters.length() / 2)
9+
return (char) (i + 'a');
10+
return '.';
11+
}
12+
13+
}

TopCoder/SRMs/SRM627/Div2_500_HappyLetterDiv2/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)