借用多字节字符串函数function my_reverse($str=null){ $encode = mb_detect_encoding($str); for($i = 0 ; $i < mb_strlen($str,$encode) ; $i++) { ...
分类:
Web程序 时间:
2015-04-02 14:52:09
阅读次数:
261
Reverse Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5763 Accepted Submission(s): 2643
Problem Description
Welcome to 2006...
分类:
其他好文 时间:
2015-04-02 09:11:01
阅读次数:
204
链接: https://leetcode.com/problems/reverse-bits/
此题的关键是预先将1
class Solution {
public:
Solution(){
unsigned int i = 0;
unsigned int j = 1;
for(; i < 32; i++)
a[i] = (j<<(31-i));
}
...
分类:
其他好文 时间:
2015-04-01 20:01:40
阅读次数:
126
反转数字,考虑溢出的情况。直接返回零(好坑啊)。public class Solution { public int reverse(int x) { if(x == 0) return 0; StringBuilder sb = new St...
分类:
其他好文 时间:
2015-04-01 01:48:15
阅读次数:
131
二进制转换和字符串逆序。要考虑int的范围,测试数据是有溢出的。Math.pow是有精度损失的,最好写成整数的。public class ReverseBits { public static int reverseBits(int n) { StringBuilder...
分类:
其他好文 时间:
2015-04-01 01:40:34
阅读次数:
122
题目:
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:[“2”, “1”, “+”, “3”, “...
分类:
其他好文 时间:
2015-04-01 00:28:51
阅读次数:
140
【思路】:atoi和itoa的使用,注意atoi,三个参数。第一个是要转换的数,第二个是保存在那个字符串中,第三个是什么进制。
【AC代码】:
#include
#include
#include
#include
#include
using namespace std;
#define MAX 20+2
int reverse_num(int x)
{
int i = 0;...
分类:
其他好文 时间:
2015-04-01 00:26:54
阅读次数:
159
LeetCode #Single Number#
刚背了单词,然后做个题玩玩~挑个软柿子踩踩~哈哈
很简单的思路.不过好玩的是我忘记检查处理完的数据是否符合整形数据返回了.因而好一会儿不能AC.
感谢 @Fantasy. 很快的指出我没有检查返回数据的范围.
先给出我超丑陋的解(python), 而后给出其他高手给出的很优雅的解!!也是用pyth...
分类:
其他好文 时间:
2015-04-01 00:24:47
阅读次数:
138
Evaluate Reverse Polish Notation问题:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand m...
分类:
其他好文 时间:
2015-03-31 20:04:55
阅读次数:
88
题目:
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain...
分类:
其他好文 时间:
2015-03-31 18:02:00
阅读次数:
114