摘要:
Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha 阅读全文
摘要:
Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B a 阅读全文
摘要:
Consider a directed graph, with nodes labelled 0, 1, ..., n-1. In this graph, each edge is either red or blue, and there could be self-edges or parall 阅读全文
摘要:
There are 3n piles of coins of varying size, you and your friends will take piles of coins as follows: In each step, you will choose any 3 piles of co 阅读全文
摘要:
Today, the bookstore owner has a store open for customers.length minutes. Every minute, some number of customers (customers[i]) enter the store, and a 阅读全文
摘要:
On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number on the display by 2, or; D 阅读全文
摘要:
In a warehouse, there is a row of barcodes, where the ith barcode is barcodes[i]. Rearrange the barcodes so that no two adjacent barcodes are equal. Y 阅读全文
摘要:
The diameter of a tree is the number of edges in the longest path in that tree. There is an undirected tree of n nodes labeled from 0 to n - 1. You ar 阅读全文
摘要:
Given the root of a binary tree, find the maximum average value of any subtree of that tree. (A subtree of a tree is any node of that tree plus all it 阅读全文
摘要:
An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same 阅读全文
摘要:
Given a rectangular cake with height h and width w, and two arrays of integers horizontalCuts and verticalCuts where horizontalCuts[i] is the distance 阅读全文
摘要:
Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes of the k weakest rows in the matrix or 阅读全文
摘要:
In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
摘要:
Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, 阅读全文
摘要:
N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side b 阅读全文
摘要:
Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a 阅读全文
摘要:
Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips betwee 阅读全文
摘要:
The distance of a pair of integers a and b is defined as the absolute difference between a and b. Given an integer array nums and an integer k, return 阅读全文
摘要:
Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation).Flip o 阅读全文
摘要:
You are given two strings s and t of the same length and an integer maxCost. You want to change s to t. Changing the ith character of s to ith charact 阅读全文