摘要:题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-
阅读全文
摘要:题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the
阅读全文
摘要:题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a
阅读全文
摘要:题目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, retur
阅读全文
摘要:题目: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum
阅读全文
摘要:题目:Reverse String (难度一颗星) Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh". 实现:
阅读全文
摘要:题目描述: 请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 分析: 看到这个题目,我们都会有一个比较直观的加法,那就是遍历字符串,每当遇到空格,就在当前位置插入“%20”,当前位置的字符往后移
阅读全文
摘要:请看题目描述: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a
阅读全文
摘要:求两个数之和。这个问题够简单吧!能做对绝对不是问题,问题是你是否能做的比较好。好了,请看题目: Given an array of integers, return indices of the two numbers such that they add up to a specific targ
阅读全文