最新 最热

[LeetCode]Roman to Integer 罗马数字转化成整数[LeetCode]Roman to Integer 罗马数字转化成整数

链接:https://leetcode.com/problems/roman-to-integer/#/description 难度:Easy 题目:13. Roman to Integer Given a roman numeral, convert it to an integer. Input is gu...

2018-09-04
0

Leetcode Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.

2018-09-04
1

777. Valid Perfect Square二分查找

Given a positive integer num, write a function which returns Trueif num is a perfect square else False.

2018-09-04
1

LeetCode 9. Palindrome Number分析代码

最常规的思路是直接将数反转再对比,但实际上,我们只需要反转后半部分跟前半部分对比就可以了。两种情况,一是位数为偶数,直接对比,位数为奇数,大数除以10对比。...

2018-08-22
1

LeetCode 118 Pascal's Triangle

Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.

2018-07-24
1

判断两个Integer值相等为什么不用==

今天在开发中判断两个Integer值相等,Integer a = 3;Duixiang duixiang = new Duixiang();duixiang = DAO.getDuixiang();Integer b = duixiang.getB();System.out.print(a == b)...

2018-06-29
1

leetcode 7 Reverse Integer

class Solution {public: int reverse(int x) { int res = 0; while (x != 0) { int t = res * 10 + x % 10; if (t / 10 !=...

2018-06-04
0

leetcode 8 String to Integer

public class Solution { public int myAtoi(String str) { if (str.isEmpty()) return 0; int sign = 1, base = 0, i = 0, n = str.length(); ...

2018-06-04
0

leetcode 12 Integer to Roman

class Solution {public: string intToRoman(int num) { string res = ""; vector<int> val{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}...

2018-06-04
0

leetcode 13 Roman to Integer

class Solution {public: int romanToInt(string s) { int res = 0; unordered_map<char, int> m{{&#x27;I&#x27;, 1}, {&#x27;V&#x27;, 5}, {&#x27;X&#x27;, 10}, {&#x27;L&#x27;, 50}, {&#x27;C&#...

2018-06-04
0