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

Added descriptions 14-16. #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
javadev merged 1 commit into javadev:main from jscrdev:descriptions-14-16
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/main/java/g0001_0100/s0014_longest_common_prefix/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
14\. Longest Common Prefix

Easy

Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string `""`.

**Example 1:**

**Input:** strs = \["flower","flow","flight"\]

**Output:** "fl"

**Example 2:**

**Input:** strs = \["dog","racecar","car"\]

**Output:** ""

**Explanation:** There is no common prefix among the input strings.

**Constraints:**

* `1 <= strs.length <= 200`
* `0 <= strs[i].length <= 200`
* `strs[i]` consists of only lower-case English letters.
30 changes: 30 additions & 0 deletions src/main/java/g0001_0100/s0015_three_sum/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
15\. 3Sum

Medium

Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`.

Notice that the solution set must not contain duplicate triplets.

**Example 1:**

**Input:** nums = \[-1,0,1,2,-1,-4\]

**Output:** \[\[-1,-1,2\],\[-1,0,1\]\]

**Example 2:**

**Input:** nums = \[\]

**Output:** \[\]

**Example 3:**

**Input:** nums = \[0\]

**Output:** \[\]

**Constraints:**

* `0 <= nums.length <= 3000`
* `-105 <= nums[i] <= 105`
29 changes: 29 additions & 0 deletions src/main/java/g0001_0100/s0016_three_sum_closest/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
16\. 3Sum Closest

Medium

Given an integer array `nums` of length `n` and an integer `target`, find three integers in `nums` such that the sum is closest to `target`.

Return _the sum of the three integers_.

You may assume that each input would have exactly one solution.

**Example 1:**

**Input:** nums = \[-1,2,1,-4\], target = 1

**Output:** 2

**Explanation:** The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).

**Example 2:**

**Input:** nums = \[0,0,0\], target = 1

**Output:** 0

**Constraints:**

* `3 <= nums.length <= 1000`
* `-1000 <= nums[i] <= 1000`
* `-104 <= target <= 104`

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