- 博客(188)
- 资源 (2)
- 收藏
- 关注
原创 写在入职之前
25号即将入职ZTE,带着对结束学生时代的不甘与从此经济独立的欣慰。在这个年纪,承受着比任何时候都多的压力,承担着比任何时候都多的责任。该学习的实在太多,不仅是知识积累,还有思维方式的锻炼,这一切,会在未来几十年的工作中决定我一生的高度吧。假期还有10天,还有什么想交代的后面再做补充。
2016-05-14 22:23:45
578
原创 Python OS 模块操作整理
一.os的简介os模块可以对不同的系统进行系统编程>>> import os #导入os模块>>> help(os) #查看os功能(内容太多,推荐使用标准库Python 3.5.1 介绍OS的链接 大概有43页,有时间再全部看一遍二.os的常用方法(3.5.1)os.sep可以取代操作系统特定的路径分隔符。windows下为 “
2016-03-06 20:58:34
662
原创 研三上学习计划
工作已经找完,后面就要忙碌着写论文,改论文。一直想给自己找点时间充充电,期待着进入工作岗位可以大展宏图。在这里给自己列一个简单的计划表,在2015年的最后两个月。1.python2.(谈恋爱)3.搞一个可以记录自己文章网站。4.上线一款android APP。
2015-10-31 21:55:23
1098
原创 2015 毕业秋招感慨
多了如此多年的书,其实就是为了找一份好工作。找工作并不是一个顺利的过程,运气,实力,毅力,这是堪比高考,考研的一场战斗。有的同学找了一个工作一玩就是两个月,有的同学,苦苦得找了两个月,却一无所获。人生并不因为现在一个选择而彻底界定,未来的路还远着。但是一定不要被生活妥协,做自己想做的事情。也希望几年的自己能收获一个满意的结局。
2015-10-18 13:54:30
500
原创 mysql允许远程访问 root
>GRANT ALL PRIVILEGES ON *.*TO 'root'@'%' IDENTIFIEDBY '123456' WITH GRANT OPTION;>FLUSHPRIVILEGES
2015-09-05 11:04:04
1205
原创 Linux下出现 error: mysql.h: No such file or directory 的解决办法
在linux 下使用C语言调用 mysql的库会出现找不到 mysql.h 的错误,解决办法如下在使用GCC编译的时候,加上如下几句需要在gcc编译时指定 头文件地址,用命令mysql_config,即可获取mysql安装后头文件所在位置,库文件所在位置,之后指定相关路径。-I /usr/include/mysql,同时需要指定mysql的库文件, 搜索目录为:-L /
2015-08-29 09:18:26
18293
原创 leetcode 162 —— Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, i
2015-08-23 15:51:31
362
原创 leetcode 160 —— Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘
2015-08-23 15:40:50
277
原创 leetcode 155 —— Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2015-08-22 13:37:56
274
原创 leetcode 154 —— Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a sorted array is rotated at some pivot u
2015-08-22 12:53:09
351
原创 leetcode 153 —— Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in
2015-08-22 12:41:46
310
原创 二进制中1的个数
public class Solution { public int countOnes(int num) { int a=1; int cnt=0; while(num>0){ if((num&a)!=0){ cnt++; } num=num>>1; } return cnt; }
2015-08-18 20:28:02
316
原创 二叉树的最大深度
public class Solution { public int cur=0; public int maxDepth(TreeNode root) { if(root==null){ return cur; } cur++; int left=maxDepth(root.left); int right=maxD
2015-08-18 19:31:47
337
原创 落单的数
思路:按位异或public class Solution { /** *@param A : an integer array *return : a integer */ public int singleNumber(int[] A) { if (A.length == 0) { return 0; } int n = A[0]; for(int
2015-08-18 18:57:09
329
原创 leetcode 152 —— Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest
2015-08-18 16:46:19
330
原创 leetcode 151 —— Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place in
2015-08-18 16:18:18
406
原创 Fizz Buzz
题目:给你一个整数n. 从 1 到 n 按照下面的规则打印每个数:如果这个数被3整除,打印fizz.如果这个数被5整除,打印buzz.如果这个数能同时被3和5整除,打印fizz buzz.样例比如 n = 15, 返回一个字符串数组:["1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz",
2015-08-18 15:16:35
1056
原创 leetcode 150 —— Evaluate Reverse Polish Notation
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",
2015-08-18 09:16:33
325
原创 leetcode 149 —— Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.思路
2015-08-17 16:34:18
298
原创 leetcode 148 —— Sort List
Sort a linked list in O(n log n) time using constant space complexity.思路:
2015-08-17 13:38:42
367
原创 leetcode 147 —— Insertion Sort List
Sort a linked list using insertion sort.思路:插入排序,从今天起,养成良好的编程风格class Solution {public: ListNode* insertionSortList(ListNode* head) { if (head == nullptr || head->next == nullptr) return he
2015-08-17 10:47:38
294
原创 leetcode 146 —— LRU Cache
思路:hash_map 和list 容器class LRUCache{public: struct node{ int key; int value; node(int k, int v) :key(k), value(v){} }; LRUCache(int capacity) { mCapacity = capacity; } int get(int key)
2015-08-16 18:31:53
629
原创 leetcode 145 —— Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut
2015-08-16 13:48:39
304
原创 leetcode 144 —— Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2015-08-16 12:59:34
363
原创 leetcode 143 —— Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to
2015-08-16 12:15:33
484
原创 leetcode 142 —— Linked List Cycle II
思路: 数学推导,第一次相遇之后,left回到head,left和right 同时同速往后遍历,相遇时则为循环节点。推导见此处http://www.cnblogs.com/x1957/p/3406448.htmlhttp://www.cnblogs.com/ballwql/p/3676843.htmlclass Solution {public: ListNode *det
2015-08-16 10:22:47
376
原创 leetcode 141 —— Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it思路 :两个指针,一个每次移动一位,一个每次移动两位,最终如果相遇说明有环class Solution {public: bool hasCycle(ListNode *head) { if (!head)
2015-08-16 09:39:27
288
原创 leetcode 139 —— Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2015-08-14 20:37:43
288
原创 leetcode 138 —— Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.思路:用map存储自己和拷贝,今天看到基友的代码class
2015-08-14 19:48:12
255
原创 leetcode 137 —— Single Number II
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 usi
2015-08-14 15:45:20
266
原创 leetcode 136 —— Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2015-08-14 10:24:41
222
原创 leetcode 135 —— Candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on
2015-08-14 10:16:14
320
原创 leetcode 134 —— Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
2015-08-13 19:56:43
299
原创 leetcode 133 —— Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for ea
2015-08-13 19:21:29
342
原创 leetcode 132 —— Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return
2015-08-13 17:18:26
310
原创 leetcode 131 —— Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","
2015-08-13 14:11:38
309
原创 leetcode 130 —— Sum Root to Leaf Numbers
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X
2015-08-13 13:16:59
229
原创 leetcode 129 —— Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota
2015-08-12 15:13:05
280
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人