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

EsperErWang/SolvedAlgorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

48 Commits

Repository files navigation

This page is used to record the problems that I have been solved, and they are classified by types.

The answers are all the most understandable and the time and space complexity can be accepted in the interview.

Binary Search (Tree) & Binary Reduction

Easy

278. First Bad Version Solution

374. Guess Number Higher or Lower Solution

35. Search Insert Position Solution

367. Valid Perfect Square Solution

Note of 69 Binary search problem should be pay attention that the value in the loop may overflow, so 69 and 367 should use long.

69. Sqrt(x) Solution

367. Valid Perfect Square Solution

700. Search in a Binary Search Tree Solution

Medium

34. Find First and Last Position of Element in Sorted Array Solution

162. Find Peak Element Solution

74. Search a 2D Matrix Solution

240. Search a 2D Matrix II Solution

Note of 33 33, 81, 153, 154 can be solved in the same idea. 154 is a hard problem, but it is the pre-problem of 81.
If the elements are not necessarily with distinct values, every binary search loop should be pay attention to nums[mid] == nums[last]. When this situation happens, we can only drop one element(last) from the nums, because we do not know if the target is in the left part or in the right part.

33. Search in Rotated Sorted Array Solution

81. Search in Rotated Sorted Array II Solution

153. Find Minimum in Rotated Sorted Array Solution

Note of 1011 1011, 410(hard), 1482, 1891 can be solved in the same idea. Try to find the possible result area, and then use the binary search to find the right result.

1011. Capacity To Ship Packages Within D Days Solution

1482. Minimum Number of Days to Make m Bouquets Solution

1891. Cutting Ribbons Solution

658. Find K Closest Elements Solution

702. Search in a Sorted Array of Unknown Size Solution

Hard

154. Find Minimum in Rotated Sorted Array II Solution

410. Split Array Largest Sum Solution

Sorting Algorithm

Easy

Note of 283 283 and 75(medium) can be solved by setting multiple board, each board's left is the correct results, and in the loop we will not care about the board's right part.when the loop is over, we can make sure that the total result is right.

283. Move Zeroes Solution

Medium

75. Sort Colors Solution

692. Top K Frequent Words Solution

Note of 912 912 is the basic problem of sorting algorithm, we should know how to implement all of them: bubble, selection, insertion, quick, merge. The theories of them can be found easily.

912. Sort an Array Solution

215. Kth Largest Element in an Array Solution

451. Sort Characters By Frequency Solution

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

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