All tags

Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

Longest Common Subsequence

Given two strings text1 and text2, return the length of their longest common subsequence.

Adjacent Cells

Eight houses, represented as cells, are arranged in a straight line. Each day every cell competes with its adjacent cells (neighbors). An integer value of 1 represents an active cell and a value of 0 represents an inactive cell. If the neighbors on both the sides of a cell are either active or inactive, the cell becomes inactive on the next day; otherwise the cell becomes active. The two cells on each end have a single adjacent cell, so assume that the unoccupied space on the opposite side is an inactive cell. Even after updating the cell state, consider its previous state when updating the state of other cells. The state information of all cells should be updated simultaneously.

Write an algorithm to output the state of the cells after the given number of days.

Maximum Depth of N Ary Tree

Given a n-ary tree, find its maximum depth.

Partition to K Equal Sum Subsets

Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.

Staircase

Consider a staircase of size n=4: # ## ### #### Observe that its base and height are both equal to , and the image is drawn using # symbols and spaces.

Maximum Number of Events That Can Be Attended

Given an array of events where events[i] = [startDayi, endDayi].

Binary Search

Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums.

Split Array Into Consecutive Subsequences

Given an array nums sorted in ascending order, return true if and only if you can split it into 1 or more subsequences such that each subsequence consists of consecutive integers and has length at least 3.

Integer Break

Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers.