1,145 tutorials

All Tutorials

Browse every programming guide — from beginner to advanced.

20 of 1,145 tutorials loaded

Problem of the DayNov 15, 2026

First Unique Character in a String — November 16, 2026

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

Problem of the DayNov 14, 2026

Single Number — November 15, 2026

Given a nonempty array of integers nums, every element appears twice except for one. Find that single one. Constraints: The array nums is nonempty. Each element in the array appears twice, except for one element which appears only once. Example: Input: nums = [2,2,1] Output: 1 An…

Problem of the DayNov 13, 2026

Merge Two Sorted Lists — November 14, 2026

You are given the heads of two sorted linked lists, list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Constraints: The number of nodes in both lists…

Problem of the DayNov 12, 2026

Plus One — November 13, 2026

You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in lefttoright order. The large integer does not contain any leading zeros, except for the…

Problem of the DayNov 11, 2026

Intersection of Two Arrays — November 12, 2026

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique, and you may return the result in any order. Constraints: 1 <= nums1.length, nums2.length <= 1000 0 <= nums1[i], nums2[i] <= 1000 Example: Input: nums1 = [1,…

Longest Common Prefix — November 10, 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 lowercase English letters az. The number of strings n will be between 0 and 200. The length of each string will be…

Group Anagrams — November 9, 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. Constraints: 1 <= strs.lengt…

Best Time to Buy and Sell Stock — November 8, 2026

You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from thi…

Contains Duplicate — November 7, 2026

Given an integer array nums, determine if it contains any duplicates. 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: Input: nums = [1,2,3,1] Output…

Reverse Words in a String — November 6, 2026

Given an input string s, reverse the order of the words. Constraints: A word is defined as a sequence of nonspace characters. Words are separated by at least one space. The input string may contain leading or trailing spaces. Multiple spaces between two words should be reduced to…

Find the Missing Number — November 5, 2026

You are given an array nums containing n distinct numbers in the range [0, n]. Your task is to find and return the only number in the range that is missing from the array. n is the length of nums. 1 <= n <= 10^4 0 <= nums[i] <= n All numbers in nums are unique. Example 1: Input:…

Valid Palindrome — November 4, 2026

A palindrome is a sequence of characters that reads the same forwards and backwards. Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation:…

Valid Parentheses — November 3, 2026

Given a string s containing just the characters (, ), {, }, [, ], determine if the input string is valid. A 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 has a corresponding op…

Rotate Array — November 2, 2026

Given an integer array nums, rotate the array to the right by k steps, where k is nonnegative. You must do this inplace with O(1) extra space. Constraints: 1 <= nums.length <= 10^5 2^31 <= nums[i] <= 2^31 1 0 <= k <= 10^5 Example: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6…