随笔分类 - LeetCode
摘要:Given an array nums and a value val, remove all instances of that value in place and return the new length. Do not allocate extra space for another ar
阅读全文
摘要:Given a 32 bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note: Assume we are dealing with an environment which co
阅读全文
摘要:You are given two non empty linked lists representing two non negative integers. The digits are stored in reverse order and each of their nodes contai
阅读全文
摘要:Description 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 or
阅读全文
摘要:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com
阅读全文
摘要:Description Given a matrix , return the transpose of . The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and
阅读全文
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe
阅读全文
摘要:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans
阅读全文
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: 1. The given i
阅读全文
摘要:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Examp
阅读全文
摘要:Given a string containing just the characters , , , , and , determine if the input string is valid. An input string is valid if: Open brackets must be
阅读全文
摘要:Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N. If there aren't two co
阅读全文
摘要:We are to write the letters of a given string , from left to right into lines. Each line has maximum width 100 units, and if writing a letter would ca
阅读全文
摘要:A self dividing number is a number that is divisible by every digit it contains. For example, 128 is a self dividing number because , , and . Also, a
阅读全文
摘要:Let's call an array A a mountain if the following properties hold: There exists some Given an array that is definitely a mountain, return any such tha
阅读全文
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n
阅读全文
摘要:Description Given a non empty, singly linked list with head node , return a middle node of linked list. If there are two middle nodes, return the seco
阅读全文
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul
阅读全文
摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex
阅读全文
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of
阅读全文