Leetcode 0500. Keyboard Row
Given an array of strings `words`, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below. In the American keyboard: ...
Given an array of strings `words`, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below. In the American keyboard: ...
Write an algorithm to determine if a number `n` is happy. A happy number is a number defined by the following process: - Starting with any positive integer, replace the number by th...
Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. Symbol Value: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, M = 1000 For example, ...
You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top? Example 1: ...
Given an integer array nums, find the `subarray` with the largest sum, and return its sum. A `subarray` is a contiguous non-empty sequence of elements within an array. Example 1: ...
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0's a...
Balanced strings are those that have an equal quantity of 'L' and 'R' characters. Given a balanced string s, split it into some number of substrings such that: Each substring is bala...
At a lemonade stand, each lemonade costs $`5`. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemo...
An image is represented by an `m x n` integer grid `image` where `image[i][j]` represents the pixel value of the image. You are also given three integers `sr`, `sc`, and `color`. You shou...
In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts n...