描述:不使用 * / % 完成除法操作。O(n)复杂度会超时,需要O(lg(n))复杂度。代码: 1 class Solution: 2 # @return an integer 3 def dividePositive(self, dividend, divisor): 4 ...
分类:
其他好文 时间:
2014-07-16 19:18:00
阅读次数:
298
create or replace function func_chinese(p_str in varchar2, -- 输入的字符串p_code in varchar2, -- dump(字符串)p_chinese in pls_integer -- 1, 提取汉字, 非1, 提取非汉字) r....
分类:
数据库 时间:
2014-07-16 19:13:11
阅读次数:
377
class Solution {public: void reverseWords(string &s) { int len = s.length(); if(len == 0) return; vector res; ...
分类:
其他好文 时间:
2014-07-16 18:50:12
阅读次数:
161
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.下面是百度得到的关于罗马数的解释:我的代码: 1 class Solution { 2 ...
分类:
其他好文 时间:
2014-07-16 18:00:22
阅读次数:
214
Problem: Implement a function to check if a singly linked list is a palindrome.思路:最简单的方法是 Reverse and compare.另外一种非常经典的办法是用 Recursive 的思路,把一个list看成这种形...
分类:
其他好文 时间:
2014-07-16 17:41:23
阅读次数:
188
比如我想将 “javascript”反转为 “tpircsavaj”。我们一般处理都是用for循环然后用StringBuffer一个字符一个字符添加。
其实StringBuffer提供了一个reverse方法就可以实现。测试代码如下:
package com.evan;
public class ReverseTest {
public static void main(String[]...
分类:
编程语言 时间:
2014-07-16 17:19:54
阅读次数:
202
Shoemaker's Problem
Shoemaker has N jobs (orders from customers) which he must make. Shoemaker can work on only one job in each day. For each ith job, it is known the integer Ti (1i<=1000...
分类:
其他好文 时间:
2014-07-16 17:12:33
阅读次数:
274
[LeetCode]Integer to Roman...
分类:
其他好文 时间:
2014-07-16 11:32:12
阅读次数:
182
/*
调用方式:add(a, b);
返回类型:string
*/
string add(string a, string b)
{
string s;
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
int i = 0;
int m, k = 0;
while(a[i] && b...
分类:
其他好文 时间:
2014-07-16 08:04:51
阅读次数:
368
public class ArrayRemoveValue { public static void main(String[] args) { Integer[] _IntArray = new Integer[]{1,2,3,4,5,6,7,9,0}; /** * 由于Arrays.as...
分类:
编程语言 时间:
2014-07-16 00:27:57
阅读次数:
400