随笔分类 -  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 阅读全文
posted @ 2018-08-25 10:39 arcsinW 阅读(101) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-21 13:25 arcsinW 阅读(131) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-20 10:52 arcsinW 阅读(133) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-18 21:00 arcsinW 阅读(118) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-17 12:21 arcsinW 阅读(221) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-15 14:36 arcsinW 阅读(328) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-14 12:33 arcsinW 阅读(144) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-14 11:20 arcsinW 阅读(103) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-14 10:58 arcsinW 阅读(98) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-14 10:47 arcsinW 阅读(114) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-10 15:50 arcsinW 阅读(104) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-09 16:27 arcsinW 阅读(275) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-09 10:50 arcsinW 阅读(122) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-04 16:50 arcsinW 阅读(143) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-03 09:57 arcsinW 阅读(346) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-02 20:47 arcsinW 阅读(94) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-07-31 19:02 arcsinW 阅读(656) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-07-31 14:28 arcsinW 阅读(118) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-07-25 14:02 arcsinW 阅读(145) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-07-24 19:23 arcsinW 阅读(144) 评论(0) 推荐(0) 编辑