随笔分类 -  leetcode

确定有限自动机 valid number
摘要:原题地址:http://oj.leetcode.com/problems/valid-number/ 题意:判断输入的字符串是否是合法的数。 解题思路:这题只能用确定有穷状态自动机(DFA)来写会比较优雅。本文参考了http://www.cnblogs.com/zuoyuan/p/3703075.h 阅读全文

posted @ 2017-11-05 13:56 Alex0111 阅读(225) 评论(0) 推荐(0)

sort与qsort的异同
摘要:主要内容: 1、qsort的用法 2、sort的用法 3、qsort和sort的区别 qsort的用法: 原 型: void qsort(void *base, int nelem, int width, int (*fcmp)(const void *,const void *)); 功 能: 使 阅读全文

posted @ 2016-12-08 23:19 Alex0111 阅读(311) 评论(0) 推荐(0)

342. Power of Four(One-line)
摘要:342. Power of Four Total Accepted: 707 Total Submissions: 2005 Difficulty: Easy Given an integer (signed 32 bits), write a function to check whether i 阅读全文

posted @ 2016-04-18 12:24 Alex0111 阅读(259) 评论(0) 推荐(0)

238. Product of Array Except Self(对O(n)和递归又有了新的理解)
摘要:238. Product of Array Except Self Total Accepted: 41565 Total Submissions: 97898 Difficulty: Medium Given an array of n integers where n > 1, nums, re 阅读全文

posted @ 2016-04-13 10:21 Alex0111 阅读(223) 评论(0) 推荐(0)

8. String to Integer (atoi)
摘要:8. String to Integer (atoi) Total Accepted: 97070 Total Submissions: 721266 Difficulty: Easy Implement atoi to convert a string to an integer. Hint: C 阅读全文

posted @ 2016-04-12 15:47 Alex0111 阅读(249) 评论(0) 推荐(0)

c 类型转换
摘要:double ←── float 高 ↑ long ↑ unsigned ↑ int ←── char,short 低 图中横向箭头表示必须的转换,如两个float型数参加运算,虽然它们类型相同,但仍要先转成double型再进行运算,结果亦为double型。 纵向箭头表示当运算符两边的运算数为不同类 阅读全文

posted @ 2016-04-12 14:33 Alex0111 阅读(149) 评论(0) 推荐(0)

100. Same Tree
摘要:100. Same Tree Total Accepted: 122794 Total Submissions: 284606 Difficulty: Easy Given two binary trees, write a function to check if they are equal o 阅读全文

posted @ 2016-04-12 10:37 Alex0111 阅读(165) 评论(0) 推荐(0)

260. Single Number III
摘要:260. Single Number III Total Accepted: 30927 Total Submissions: 71149 Difficulty: Medium Given an array of numbers nums, in which exactly two elements 阅读全文

posted @ 2016-04-11 13:32 Alex0111 阅读(116) 评论(0) 推荐(0)

137. Single Number II
摘要:137. Single Number II Total Accepted: 80477 Total Submissions: 214984 Difficulty: Medium Given an array of integers, every element appears three times 阅读全文

posted @ 2016-04-10 12:32 Alex0111 阅读(319) 评论(0) 推荐(0)

237. Delete Node in a Linked List
摘要:237. Delete Node in a Linked List Total Accepted: 74501 Total Submissions: 170753 Difficulty: Easy Write a function to delete a node (except the tail) 阅读全文

posted @ 2016-04-10 12:08 Alex0111 阅读(199) 评论(0) 推荐(0)

283. Move Zeroes
摘要:283. Move Zeroes Total Accepted: 71969 Total Submissions: 163725 Difficulty: Easy Given an array nums, write a function to move all 0's to the end of 阅读全文

posted @ 2016-04-10 11:46 Alex0111 阅读(173) 评论(0) 推荐(0)

104. Maximum Depth of Binary Tree
摘要:104. Maximum Depth of Binary Tree Total Accepted: 136537 Total Submissions: 286367 Difficulty: Easy Given a binary tree, find its maximum depth. The m 阅读全文

posted @ 2016-04-10 11:31 Alex0111 阅读(160) 评论(0) 推荐(0)

258. Add Digits
摘要:258. Add Digits Total Accepted: 85971 Total Submissions: 177841 Difficulty: Easy Given a non-negative integer num, repeatedly add all its digits until 阅读全文

posted @ 2016-04-10 11:20 Alex0111 阅读(138) 评论(0) 推荐(0)

136. Single Number
摘要:136. Single Number Total Accepted: 123186 Total Submissions: 249218 Difficulty: Medium Given an array of integers, every element appears twice except 阅读全文

posted @ 2016-04-10 11:12 Alex0111 阅读(204) 评论(0) 推荐(0)

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 r 阅读全文

posted @ 2016-04-08 15:55 Alex0111 阅读(172) 评论(0) 推荐(0)

导航