Skip to content

Commit 642fbb1

Browse files
committed
address code review feedback
1 parent 869ca89 commit 642fbb1

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

find-minimum-in-rotated-sorted-array/seongmin36.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ function findMin(nums) {
1212
let left = 0;
1313
let right = nums.length - 1;
1414

15+
if (nums[left] <= nums[right]) return nums[left]; // 일자 배열인 경우
16+
1517
while (left < right) {
1618
let mid = Math.floor((left + right) / 2);
1719

20+
if (nums[mid] > nums[mid + 1]) return nums[mid + 1]; // mid의 바로 옆에서 초기화되는 경우
21+
1822
if (nums[mid] > nums[right]) {
1923
left = mid + 1;
2024
} else {

maximum-depth-of-binary-tree/seongmin36.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@ function maxDepth(root) {
2121
let left_depth = maxDepth(root.left);
2222
let right_depth = maxDepth(root.right);
2323

24-
let count = Math.max(left_depth, right_depth) + 1;
25-
26-
return count;
24+
return Math.max(left_depth, right_depth) + 1;
2725
}

0 commit comments

Comments
 (0)