Skip to content

Commit f10d32f

Browse files
committed
Update
1 parent d3f6cd1 commit f10d32f

File tree

1,510 files changed

+1577
-1509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,510 files changed

+1577
-1509
lines changed

0001-0500/0001. Two Sum.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 1. Two Sum
66
// Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

0001-0500/0002. Add Two Numbers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Solution {
1313

14-
// Solution @ Sergey Leschev
14+
// Solution by Sergey Leschev
1515

1616
// 2. Add Two Numbers
1717
// You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.

0001-0500/0003. Longest Substring Without Repeating Characters.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 3. Longest Substring Without Repeating Characters
66
// Given a string s, find the length of the longest substring without repeating characters.

0001-0500/0004. Median of Two Sorted Arrays.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 4. Median of Two Sorted Arrays
66
// Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

0001-0500/0005. Longest Palindromic Substring.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 5. Longest Palindromic Substring
66
// Given a string s, return the longest palindromic substring in s.

0001-0500/0006. ZigZag Conversion.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 6. ZigZag Conversion
66
// 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)

0001-0500/0007. Reverse Integer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 7. Reverse Integer
66
// 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 [-2^31, 2^31 - 1], then return 0.

0001-0500/0008. String to Integer (atoi).swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 8. String to Integer (atoi)
66
// Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).

0001-0500/0009. Palindrome Number.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 9. Palindrome Number
66
// Given an integer x, return true if x is palindrome integer.

0001-0500/0010. Regular Expression Matching.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 10. Regular Expression Matching
66
// Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*' where:

0001-0500/0011. Container With Most Water.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 11. Container With Most Water
66
// Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water.

0001-0500/0012. Integer to Roman.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 12. Integer to Roman
66
// Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

0001-0500/0013. Roman to Integer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 13. Roman to Integer
66
// Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

0001-0500/0014. Longest Common Prefix.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 14. Longest Common Prefix
66
// Write a function to find the longest common prefix string amongst an array of strings.

0001-0500/0015. 3Sum.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschevs
3+
// Solution by Sergey Leschevs
44

55
// 15. 3Sum
66
// 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.

0001-0500/0016. 3Sum Closest.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 16. 3Sum Closest
66
// Given an array nums of n integers 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.

0001-0500/0017. Letter Combinations of a Phone Number.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 17. Letter Combinations of a Phone Number
66
// Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

0001-0500/0018. 4Sum.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 18. 4Sum
66
// Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:

0001-0500/0019. Remove Nth Node From End of List.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Solution {
1212

13-
// Solution @ Sergey Leschev
13+
// Solution by Sergey Leschev
1414

1515
// 19. Remove Nth Node From End of List
1616
// Given the head of a linked list, remove the nth node from the end of the list and return its head.

0001-0500/0020. Valid Parentheses.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 20. Valid Parentheses
66
// Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

0001-0500/0021. Merge Two Sorted Lists.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Solution {
1212

13-
// Solution @ Sergey Leschev
13+
// Solution by Sergey Leschev
1414

1515
// 21. Merge Two Sorted Lists
1616
// Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists.

0001-0500/0022. Generate Parentheses.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 22. Generate Parentheses
66
// Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

0001-0500/0023. Merge k Sorted Lists.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Solution {
1212

13-
// Solution @ Sergey Leschev
13+
// Solution by Sergey Leschev
1414

1515
// 23. Merge k Sorted Lists
1616
// You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.

0001-0500/0024. Swap Nodes in Pairs.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Solution {
1212

13-
// Solution @ Sergey Leschev
13+
// Solution by Sergey Leschev
1414

1515
// 24. Swap Nodes in Pairs
1616
// Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)

0001-0500/0025. Reverse Nodes in k-Group.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Solution {
1212

13-
// Solution @ Sergey Leschev
13+
// Solution by Sergey Leschev
1414

1515
// 25. Reverse Nodes in k-Group
1616
// Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.

0001-0500/0026. Remove Duplicates from Sorted Array.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 26. Remove Duplicates from Sorted Array
66
// Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.

0001-0500/0027. Remove Element.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 27. Remove Element
66
// Given an array nums and a value val, remove all instances of that value in-place and return the new length.

0001-0500/0028. Implement strStr().swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 28. Implement strStr()
66
// Implement strStr().

0001-0500/0029. Divide Two Integers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 29. Divide Two Integers
66
// Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator.

0001-0500/0030. Substring with Concatenation of All Words.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 30. Substring with Concatenation of All Words
66
// You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in words exactly once, in any order, and without any intervening characters.

0001-0500/0031. Next Permutation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 31. Next Permutation
66
// Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.

0001-0500/0032. Longest Valid Parentheses.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 32. Longest Valid Parentheses
66
// Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.

0001-0500/0033. Search in Rotated Sorted Array.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 33. Search in Rotated Sorted Array
66
// There is an integer array nums sorted in ascending order (with distinct values).

0001-0500/0034. Find First and Last Position of Element in Sorted Array.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 34. Find First and Last Position of Element in Sorted Array
66
// Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.

0001-0500/0035. Search Insert Position.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 35. Search Insert Position
66
// Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

0001-0500/0036. Valid Sudoku.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 36. Valid Sudoku
66
// Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

0001-0500/0037. Sudoku Solver.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 37. Sudoku Solver
66
// Write a program to solve a Sudoku puzzle by filling the empty cells.

0001-0500/0038. Count and Say.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 38. Count and Say
66
// The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

0001-0500/0039. Combination Sum.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 39. Combination Sum
66
// Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.

0001-0500/0040. Combination Sum II.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 40. Combination Sum II
66
// Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

0001-0500/0041. First Missing Positive.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 41. First Missing Positive
66
// Given an unsorted integer array nums, find the smallest missing positive integer.

0001-0500/0042. Trapping Rain Water.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 42. Trapping Rain Water
66
// Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

0001-0500/0043. Multiply Strings.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 43. Multiply Strings
66
// Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

0001-0500/0044. Wildcard Matching.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 44. Wildcard Matching
66
// Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where:

0001-0500/0045. Jump Game II.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 45. Jump Game II
66
// Given an array of non-negative integers nums, you are initially positioned at the first index of the array.

0001-0500/0046. Permutations.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 46. Permutations
66
// Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

0001-0500/0047. Permutations II.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 47. Permutations II
66
// Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

0001-0500/0048. Rotate Image.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 48. Rotate Image
66
// You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).

0001-0500/0049. Group Anagrams.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution {
22

3-
// Solution @ Sergey Leschev
3+
// Solution by Sergey Leschev
44

55
// 49. Group Anagrams
66
// Given an array of strings strs, group the anagrams together. You can return the answer in any order.

0 commit comments

Comments
 (0)