- 博客(17)
- 收藏
- 关注
原创 349. Intersection of Two Arrays
Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: •Each element in the result must be unique.
2016-05-31 08:17:09 313
原创 350. Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: •Each element in the result should appear a
2016-05-28 12:18:54 205
转载 15. 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: •Elements in a triplet
2016-05-27 14:34:27 208
原创 第1章 安装
1.使用虚拟环境的好处和意义:系统安装了全局python解释器后,如果在同一个系统中进行两个以上程序的开发,使用虚拟环境可为每个程序单独创建虚拟环境。程序只能访问虚拟环境中的包,这样就避免了包的混乱以及版本冲突等问题。虚拟环境不需要管理员权限。2.安装创建及激活虚拟环境: 检查是否安装virtualenv:$ virtualenv --version 如果显示错误,就需要在浏览器中输入网址
2016-05-17 09:50:08 461
原创 前言
CSDN开博不久。最近脚伤住院,百无聊赖于是想梳理一下过去自己在学习《Flask web开发-基于Python的Web应用开发实战》中的一些心得体会。一方面用来重新回顾整理一下学到的东西,另一方面若有志同者有缘看到这个系列的博文,也可避免我之前所走的一些弯路,能够节省下一些时间。此两点是此系列博文的主要目的。
2016-05-17 08:27:46 243
转载 342. Power of Four
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return false. Follow up: Could you solve it
2016-05-16 23:00:58 219
翻译 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example: For n
2016-05-16 22:12:29 187
原创 347. Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements. For example, Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: •You may assume k is always valid, 1 ≤ k ≤
2016-05-14 21:58:36 328
原创 268. Missing Number
Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note : Your algorithm
2016-05-14 16:59:31 196
转载 343. Integer Break
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n
2016-05-14 09:56:52 246
转载 217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every eleme
2016-05-13 18:19:44 255
转载 283. Move Zeroes
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling
2016-05-13 17:52:55 243
转载 258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 h
2016-05-13 17:45:46 378
转载 292. Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will b
2016-05-13 17:29:45 241
转载 344. Reverse String
344 Reverse String Write a function that takes a string as input and returns the string reversed. Example: Given s = “hello”, return “olleh”.My answers always with python:class Solution(obj
2016-05-13 09:57:20 289
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人