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 description for tasks 4-7. #21

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:added-description4
Nov 17, 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
Added description for tasks 4-7.
  • Loading branch information
javadev committed Nov 17, 2021
commit ee62b1dcab297a0777c3c1874f66ae9bf01f2ee0
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
4\. Median of Two Sorted Arrays

Hard

Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return **the median** of the two sorted arrays.

The overall run time complexity should be `O(log (m+n))`.

**Example 1:**

**Input:** nums1 = \[1,3\], nums2 = \[2\]

**Output:** 2.00000

**Explanation:** merged array = \[1,2,3\] and median is 2.

**Example 2:**

**Input:** nums1 = \[1,2\], nums2 = \[3,4\]

**Output:** 2.50000

**Explanation:** merged array = \[1,2,3,4\] and median is (2 + 3) / 2 = 2.5.

**Example 3:**

**Input:** nums1 = \[0,0\], nums2 = \[0,0\]

**Output:** 0.00000

**Example 4:**

**Input:** nums1 = \[\], nums2 = \[1\]

**Output:** 1.00000

**Example 5:**

**Input:** nums1 = \[2\], nums2 = \[\]

**Output:** 2.00000

**Constraints:**

* `nums1.length == m`
* `nums2.length == n`
* `0 <= m <= 1000`
* `0 <= n <= 1000`
* `1 <= m + n <= 2000`
* `-106 <= nums1[i], nums2[i] <= 106`
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
5\. Longest Palindromic Substring

Medium

Given a string `s`, return _the longest palindromic substring_ in `s`.

**Example 1:**

**Input:** s = "babad"

**Output:** "bab" **Note:** "aba" is also a valid answer.

**Example 2:**

**Input:** s = "cbbd"

**Output:** "bb"

**Example 3:**

**Input:** s = "a"

**Output:** "a"

**Example 4:**

**Input:** s = "ac"

**Output:** "a"

**Constraints:**

* `1 <= s.length <= 1000`
* `s` consist of only digits and English letters.
39 changes: 39 additions & 0 deletions src/main/java/g0001_0100/s0006_zigzag_conversion/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
6\. Zigzag Conversion

Medium

The string `"PAYPALISHIRING"` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

P A H N A P L S I I G Y I R

And then read line by line: `"PAHNAPLSIIGYIR"`

Write the code that will take a string and make this conversion given a number of rows:

string convert(string s, int numRows);

**Example 1:**

**Input:** s = "PAYPALISHIRING", numRows = 3

**Output:** "PAHNAPLSIIGYIR"

**Example 2:**

**Input:** s = "PAYPALISHIRING", numRows = 4

**Output:** "PINALSIGYAHRPI"

**Explanation:** P I N A L S I G Y A H R P I

**Example 3:**

**Input:** s = "A", numRows = 1

**Output:** "A"

**Constraints:**

* `1 <= s.length <= 1000`
* `s` consists of English letters (lower-case and upper-case), `','` and `'.'`.
* `1 <= numRows <= 1000`
35 changes: 35 additions & 0 deletions src/main/java/g0001_0100/s0007_reverse_integer/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
7\. Reverse Integer

Medium

Given a signed 32-bit integer `x`, return `x` _with its digits reversed_. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-231, 231 - 1]`, then return `0`.

**Assume the environment does not allow you to store 64-bit integers (signed or unsigned).**

**Example 1:**

**Input:** x = 123

**Output:** 321

**Example 2:**

**Input:** x = -123

**Output:** -321

**Example 3:**

**Input:** x = 120

**Output:** 21

**Example 4:**

**Input:** x = 0

**Output:** 0

**Constraints:**

* `-231 <= x <= 231 - 1`

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