This is a collection of LeetCode solutions written in TypeScript. This repository contains a variety of coding challenges completed as part of my journey through LeetCode's problem sets. Each solution is crafted to help understand and master different algorithms and data structures.
-
Two Sum
- Problem Number: 1
- Description: Given an array of integers, return indices of the two numbers such that they add up to a specific target.
- Link: Two Sum
-
Longest Substring Without Repeating Characters
- Problem Number: 3
- Description: Given a string, find the length of the longest substring without repeating characters.
- Link: Longest Substring Without Repeating Characters
-
Median of Two Sorted Arrays
- Problem Number: 4
- Description: Given two sorted arrays, find the median of the two sorted arrays.
- Link: Median of Two Sorted Arrays
-
Longest Palindromic Substring
- Problem Number: 5
- Description: Given a string, return the longest palindromic substring in it.
- Link: Longest Palindromic Substring
-
Zigzag Conversion
- Problem Number: 6
- Description: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows. Write the code that will take a string and make this conversion given a number of rows.
- Link: Zigzag Conversion
-
Reverse Integer
- Problem Number: 7
- Description: 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.
- Link: Reverse Integer
-
Palindrome Number
- Problem Number: 9
- Description: Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
- Link: Palindrome Number
-
Container With Most Water
- Problem Number: 11
- Description: 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 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.
- Link: Container With Most Water
-
3Sum
- Problem Number: 15
- Description: 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.
- Link: 3Sum
-
Valid Parentheses
- Problem Number: 20
- Description: Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
- Link: Valid Parentheses
-
Find the Index of the First Occurrence in a String
- Problem Number: 28
- Description: Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
- Link: Find the Index of the First Occurrence in a String
-
Text Justification
- Problem Number: 68
- Description: Given an array of words and a length maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.
- Link: Text Justification
-
Valid Palindrome
- Problem Number: 125
- Description: Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
- Link: Valid Palindrome
-
Reverse Words in a String
- Problem Number: 151
- Description: Given an input string s, reverse the string word by word.
- Link: Reverse Words in a String
-
Two Sum II - Input Array Is Sorted
- Problem Number: 167
- Description: Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number.
- Link: Two Sum II - Input Array Is Sorted
-
Kth Largest Element in an Array
- Problem Number: 215
- Description: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
- Link: Kth Largest Element in an Array
-
Is Subsequence
- Problem Number: 392
- Description: Given two strings s and t, return true if s is a subsequence of t, or false otherwise.
- Link: Is Subsequence
-
Valid Palindrome II
- Problem Number: 680
- Description: Given a string s, return true if the s can be a palindrome after deleting at most one character from it.
- Link: Valid Palindrome II
-
Unique Length-3 Palindromic Subsequences
- Problem Number: 1930
- Description: Given a string s, return the number of unique palindromic subsequences of length 3.
- Link: Unique Length-3 Palindromic Subsequences
-
Number of Ways to Split Array
- Problem Number: 2270
- Description: You are given a 0-indexed integer array nums. You can split the array into two non-empty parts such that the sum of the elements in the left part is less than or equal to the sum of the elements in the right part.
- Link: Number of Ways to Split Array
-
Shifting Letters II
- Problem Number: 2381
- Description: You are given a string s and a 2D integer array shifts where shifts[i] = [startIndex, endIndex, direction]. You need to perform the shifts on the string s.
- Link: Shifting Letters II
-
Count Vowel Strings in Ranges
- Problem Number: 2559
- Description: Given an array of strings words and an array of queries, return an array of integers answer where answer[i] is the number of strings in words that are valid according to the query.
- Link: Count Vowel Strings in Ranges