Skip to main content

38 docs tagged with "TikTok"

View All Tags

3Sum

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.

Backspace String Compare

Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.

Best Time To Buy And Sell Stock

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.

Binary Tree Maximum Path Sum

A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once.

Coin Change

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

Combination Sum

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.

Container With Most Water

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the...

Course Schedule

For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return false.

Course Schedule II

Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.

Decode Ways

Given a string s containing only digits, return the number of ways to decode it.

Find K Closest Elements

Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array.

Find Peak Element

A peak element is an element that is strictly greater than its neighbors.

House Robber

Given an integer array nums representing the amount of money of each house, return *the maximum amount of money you can rob tonight without alerting the police.

House Robber II

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle.

Maximum Subarray

Given an integer array nums, find the subarray which has the largest sum and return its sum.

Median of Two Sorted Arrays

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

N-Queens

The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.

Number of Islands

Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.

Pacific Atlantic Water Flow

There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges.

Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.

Path Sum III

Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum.

Permutations

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

Product of Array Except Self

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

Reverse Nodes in k-Group

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.

Search in Rotated Sorted Array

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

Sort List

Given the head of a linked list, return the list after sorting it in ascending order.

Spiral Matrix

Given an m x n matrix, return all elements of the matrix in spiral order.

Subsets

Given an integer array nums of unique elements, return all possible subsets (the power set).

Subsets II

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.

Unique Paths

There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0])...

Word Break

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

Word Search

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

Word Search II

Given an m x n board of characters and a list of strings words, return all words on the board.