摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The pro 阅读全文
posted @ 2019-10-17 23:58 CNoodle 阅读(162) 评论(0) 推荐(0)
摘要: The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When study 阅读全文
posted @ 2019-10-17 01:04 CNoodle 阅读(199) 评论(0) 推荐(0)
摘要: Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in 阅读全文
posted @ 2019-10-17 00:08 CNoodle 阅读(485) 评论(0) 推荐(0)
摘要: Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. If no such 阅读全文
posted @ 2019-10-16 23:38 CNoodle 阅读(190) 评论(0) 推荐(0)
摘要: Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some 阅读全文
posted @ 2019-10-15 23:48 CNoodle 阅读(463) 评论(0) 推荐(0)
摘要: Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. Example 1: 阅读全文
posted @ 2019-10-15 23:13 CNoodle 阅读(200) 评论(0) 推荐(0)
摘要: Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Examp 阅读全文
posted @ 2019-10-14 11:51 CNoodle 阅读(175) 评论(0) 推荐(0)
摘要: 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 intege 阅读全文
posted @ 2019-10-14 11:27 CNoodle 阅读(232) 评论(0) 推荐(0)
摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2019-10-13 14:42 CNoodle 阅读(245) 评论(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 conta 阅读全文
posted @ 2019-10-13 06:41 CNoodle 阅读(481) 评论(0) 推荐(0)
摘要: Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer. The algorithm for myAtoi(string s) is as follows: Whitesp 阅读全文
posted @ 2019-10-13 01:06 CNoodle 阅读(454) 评论(0) 推荐(0)
摘要: Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place 阅读全文
posted @ 2019-10-12 08:45 CNoodle 阅读(161) 评论(0) 推荐(0)
摘要: The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1]. 阅读全文
posted @ 2019-10-12 00:58 CNoodle 阅读(287) 评论(0) 推荐(0)
摘要: Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 阅读全文
posted @ 2019-10-11 01:22 CNoodle 阅读(474) 评论(0) 推荐(0)
摘要: Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode" 阅读全文
posted @ 2019-10-10 07:23 CNoodle 阅读(174) 评论(0) 推荐(0)
摘要: Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. Each letter in magazine can 阅读全文
posted @ 2019-10-10 06:46 CNoodle 阅读(307) 评论(0) 推荐(0)
摘要: Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters 阅读全文
posted @ 2019-10-10 06:08 CNoodle 阅读(227) 评论(0) 推荐(0)
摘要: You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered fro 阅读全文
posted @ 2019-10-10 02:17 CNoodle 阅读(712) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n 阅读全文
posted @ 2019-10-09 11:11 CNoodle 阅读(516) 评论(0) 推荐(0)
摘要: Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 阅读全文
posted @ 2019-10-09 08:59 CNoodle 阅读(182) 评论(0) 推荐(0)