上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 33 下一页
摘要: STL中的string有6个查找函数: 1.find() 2.rfind() 从最后一个字符开始往前找。 3.find_first_of() 4.find_not_first_of() 5.find_last_of() 6.find_not_last_of() 所有这些查找函数返回值都是size_t 阅读全文
posted @ 2016-04-17 16:25 周洋 阅读(662) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 简单的二进制高精度加法。 阅读全文
posted @ 2016-04-17 15:20 周洋 阅读(207) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a 阅读全文
posted @ 2016-04-16 23:21 周洋 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 就是简单的应用多数投票算法(Boyer–Moore majority vote algorithm),参见这道题的题解。 阅读全文
posted @ 2016-04-16 22:23 周洋 阅读(787) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that 阅读全文
posted @ 2016-04-16 22:14 周洋 阅读(1089) 评论(0) 推荐(0) 编辑
摘要: Model.save(force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None) id和pk 如果一个model里没有显示声明哪一个字段(field)是主键(即在某个字段里声明primary_ 阅读全文
posted @ 2016-04-16 01:35 周洋 阅读(36637) 评论(0) 推荐(3) 编辑
摘要: C语言的字符串要注意最后一位默认是'/0'的问题。这是一个易错点。 strlen()计算长度时不考虑末尾的'\0' string定义的长度是10,str1的最后一位默认为'\0',所以str1其实长度为11。strcpy()函数中,如果第二个串比第一个串长,是没有error的,第一个串的长度会增加, 阅读全文
posted @ 2016-04-07 02:39 周洋 阅读(4932) 评论(0) 推荐(0) 编辑
摘要: 一个由C/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数参数值,局部变量的值等。其操作方式类似于数据结构中的栈。 2、堆区(heap) — 一般由程序员分配释放 , 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分 阅读全文
posted @ 2016-04-01 15:35 周洋 阅读(573) 评论(0) 推荐(0) 编辑
摘要: 1.strip():把头和尾的空格去掉 2.lstrip():把左边的空格去掉 3.rstrip():把右边的空格去掉 4.replace('c1','c2'):把字符串里的c1替换成c2。故可以用replace(' ','')来去掉字符串里的所有空格 5.split():通过指定分隔符对字符串进行 阅读全文
posted @ 2016-03-27 14:36 周洋 阅读(183351) 评论(2) 推荐(9) 编辑
摘要: 这个题需要对指针理解的比较到位。然后方法就很直接:奇数的连起来,偶数的连起来,最后拼在一起。 阅读全文
posted @ 2016-03-23 00:08 周洋 阅读(215) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 33 下一页