772 tutorials

All Tutorials

Browse every programming guide — from beginner to advanced.

20 of 772 tutorials loaded

Problem of the DayOct 16, 2026

Contains Duplicate — October 17, 2026

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Constraints: 1 <= nums.length <= 10^5 10^9 <= nums[i] <= 10^9 Example 1: Input: nums = [1,2,3,1] Output: true Example 2: Input: nums = [1,2,3,…

Problem of the DayOct 15, 2026

First Unique Character in a String — October 16, 2026

Given a string s, find the first nonrepeating character in it and return its index. If it does not exist, return 1. The string s will only contain lowercase English letters. 1 <= s.length <= 10^5 Example 1: Input: s = "leetcode" Output: 0 Example 2: Input: s = "loveleetcode" Outp…

Problem of the DayOct 14, 2026

Remove Duplicates from Sorted Array — October 15, 2026

Given a sorted array nums, remove the duplicates inplace such that each unique element appears only once. The relative order of the elements should be preserved. Return Value: The function should return the new length of the array after removing duplicates. Constraints: Do not al…

Problem of the DayOct 13, 2026

Maximum Subarray Sum — October 14, 2026

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Constraints: 1 <= nums.length <= 10^5 10^4 <= nums[i] <= 10^4 Example: Input: nums = [2,1,3,4,1,2,1,5,4] Output: 6 Explanation: The subarray [4…

Problem of the DayOct 12, 2026

Valid Parentheses — October 13, 2026

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket…

Problem of the DayOct 11, 2026

Palindrome Permutation — October 12, 2026

Given a string s, determine if it is a permutation of a palindrome. This means the characters of s can be rearranged to form a palindrome. Caseinsensitive: 'A' is considered the same as 'a'. Ignore nonalphanumeric characters: Spaces, punctuation, etc., should be disregarded. Exam…

Problem of the DayOct 10, 2026

Single Number — October 11, 2026

Given a nonempty array of integers, every element appears twice except for one. Find that single one. Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Examples: Input: [2,2,1] Output: 1 Input: [4,1,2,1,2] Output: 4

Group Anagrams — October 10, 2026

Given an array of strings strs, group the anagrams together. You can return the answer in any order. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.\n\n Constraints:\n 1 <= strs…

Valid Anagram — October 9, 2026

Given two strings s and t, determine if t is an anagram of s. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Constraints 1 <= s.length, t.length <= 5 10^4 s and t consist of lo…

Two Sum — October 8, 2026

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. The order of the returned indices does not matter.…

Longest Common Prefix — October 7, 2026

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 "".All given inputs are in lowercase English letters az. Constraints 0 <= strs.length <= 200 0 <= strs[i].length <= 200 strs[i] consists of o…

Find the Missing Number — October 5, 2026

Given an array nums containing n distinct numbers in the range [0, n], your task is to return the only number in the range that is missing from the array. The array nums contains n distinct numbers. The numbers are guaranteed to be in the range [0, n]. n represents the length of…

Reverse Words in a String — October 4, 2026

Given an input string s, reverse the order of the words. A word is defined as a sequence of nonspace characters. Words in s will be separated by at least one space. The reversed string should not contain leading or trailing spaces. Multiple spaces between two words should be redu…

Count Good Pairs — October 3, 2026

Given an array of integers nums, a pair (i, j) is called a good pair if nums[i] == nums[j] and i < j. Return the number of good pairs. Input: An array of integers nums. Constraints: 1 <= nums.length <= 100 1 <= nums[i] <= 100 Output: An integer representing the total count of goo…