题目Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For...
分类:
其他好文 时间:
2015-07-31 18:30:51
阅读次数:
102
Given an array of n integers where n > 1, nums,
return an array output such that output[i] is
equal to the product of all the elements of nums except nums[i].
Solve it without division and in O...
分类:
其他好文 时间:
2015-07-31 10:33:59
阅读次数:
144
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv...
分类:
其他好文 时间:
2015-07-31 07:50:54
阅读次数:
133
题目:Given an array of integers, every element appearsthreetimes except for one. Find that single one.解法一:O(n*n)时间复杂度。编译一下,果然没通过。程序如下:不过我觉得本算法最简单,而且通用性是...
分类:
其他好文 时间:
2015-07-30 01:57:07
阅读次数:
115
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using...
分类:
其他好文 时间:
2015-07-30 00:55:12
阅读次数:
139
Description:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 ...
分类:
其他好文 时间:
2015-07-29 22:47:19
阅读次数:
146
一、用python写一个列举当前目录以及所有子目录下的文件,并打印出绝对路径#!/usr/bin/envpythonimportosforroot,dirs,filesinos.walk(‘/tmp‘):fornameinfiles:print(os.path.join(root,name))os.walk()原型为:os.walk(top,topdown=True,onerror=None,followlinks=False)我们..
分类:
编程语言 时间:
2015-07-29 19:39:41
阅读次数:
138
1.写个程序,接受用户输入数字,并进行校验,非数字给出错误提示,然后重新等待用户输入。2.根据用户输入数字,输出从0到该数字之间所有的素数。(只能被1和自身整除的数为素数)#!/usr/bin/envpython#coding=utf-8importtabimportsyswhileTrue:try:n=int(raw_input(‘请输入数字..
分类:
其他好文 时间:
2015-07-29 19:39:00
阅读次数:
172
Given a complete binary tree, count the number of nodes.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely fille...
分类:
其他好文 时间:
2015-07-29 19:25:50
阅读次数:
147
https://leetcode.com/problems/product-of-array-except-self/Given an array of n integers where n > 1, nums, return an array output such that output[i] ...
分类:
其他好文 时间:
2015-07-29 15:26:48
阅读次数:
95