![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
summer_liuwei
这个作者很懒,什么都没留下…
展开
-
Excel Sheet Column Title
Excel Sheet Column Title 递归实现,当n % 26 == 0时需要特殊处理,讲对应位置Z。class Solution {public: string convertToTitle(int n) { string s; if (n <= 0) { return s;原创 2015-04-04 18:47:24 · 495 阅读 · 0 评论 -
Power of Two
Power of Two Given an integer, write a function to determine if it is a power of two.class Solution {public: bool isPowerOfTwo(int n) { if (n <= 0) { return false;原创 2015-07-29 22:19:55 · 386 阅读 · 0 评论 -
Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of convertin原创 2015-05-02 21:16:34 · 402 阅读 · 0 评论 -
String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2015-05-02 20:24:10 · 410 阅读 · 0 评论 -
Number of 1 Bits
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-bit integer ’11' has binary representation 000000原创 2015-04-09 22:22:19 · 447 阅读 · 0 评论 -
Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2015-04-07 23:24:14 · 517 阅读 · 0 评论 -
Add Two Numbers
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 single digit. Add the two numbers and return it as a link原创 2015-04-11 20:48:35 · 486 阅读 · 0 评论 -
Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before原创 2015-04-11 21:51:47 · 498 阅读 · 0 评论 -
Excel Sheet Column Number
Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 class Solution {原创 2015-04-05 09:50:12 · 425 阅读 · 0 评论 -
leetcode 227: Basic Calculator II
Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should原创 2015-10-24 11:49:23 · 1394 阅读 · 0 评论