Skip to content

Commit 51e1dcb

Browse files
delete binary search
1 parent 8e49403 commit 51e1dcb

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

atcoder-problems-frontend/src/pages/ListPage/SmallTable.tsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,34 +69,16 @@ export const SmallTable: React.FC<Props> = ({ submissions, setFilterFunc }) => {
6969
[]
7070
);
7171

72-
const binarySearch = (
73-
arr: { point: number; count: number }[],
74-
target: number
75-
) => {
76-
let left = 0;
77-
let right = arr.length;
78-
while (right - left > 1) {
79-
const mid = Math.floor((left + right) / 2);
80-
if (arr[mid].point <= target) {
81-
left = mid;
82-
} else {
83-
right = mid;
84-
}
85-
}
86-
return left;
87-
};
88-
8972
const getUserPointCountInArea = (
9073
countByPoint: Map<number | null | undefined, number>,
9174
pointStart: number,
9275
pointEnd: number
9376
) => {
9477
let ret = 0;
95-
for (
96-
let i = binarySearch(totalCount, pointStart);
97-
i < totalCount.length;
98-
i++
99-
) {
78+
for (let i = 0; i < totalCount.length; i++) {
79+
if (totalCount[i].point < pointStart) {
80+
continue;
81+
}
10082
if (totalCount[i].point >= pointEnd) {
10183
break;
10284
}

0 commit comments

Comments
 (0)