2016-06-16 YongHao Hu
C++
231. Power of Two Question Given an integer, write a function to determine if it is a power of two. Solution Approach #1 (count the number of 1) [Accepted] Algorithm Integer is a power of two means only one bit of n is '1', for example, 100 is 2^2=4 while 110 is 2^2+2^1=6. 继续阅读 »
2016-06-26 ruki
Typically, you only need to execute the following command for compiling project. bash xmake xmake will probe your host environment and target platform automaticly. The default mode is release and xmake will compile all targets. You can compile only one given target which name is 'test' for executing the follo 继续阅读 »
2011-01-24 walter lee
This article goes out to all those special people in my heart Every person that matters the most,you know who you are Does not matter for now,does not matter latter All I gonna to do is make that call Turn around,there you are And so to you from the bottom of my heart,I wanna say one thing:Thank you 继续阅读 »
2020-07-25 Robin Wen
文/Robin 由于工作的特殊性,我常年同时使用 4 台手机,2 台 iPhone,2 台 Android 机。其中一台手机是 OnePlus,也就是一加。 可能读者对 OnePlus 陌生,在此笔者做简短的介绍。 一加(全称:深圳市万普拉斯科技有限公司,英语:OnePlus)是中国一家行动通讯终端装置研制与软件开发的企业,于 2012 年 10 月 14 日由刘作虎和裴宇主导成立,其产品于全球多国市场销售。 2019 年 10 月 15 日,一加发布 OnePlus 7T。发布会刘作虎透露关键信息,目前一加手机销量海外占比已经达到 70%,而在国内的占比只占 30%。 2020 年 4 月 16 日,一加发布 One 继续阅读 »
2016-06-06 craneyuan
Question Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. 解说 这道题的意思是,如何反向删 继续阅读 »
2016-05-06 craneyuan
Question Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. UPDATE (2016/2/13): The return forma 继续阅读 »
2015-11-27 Oliver Wang
直接写 js function imgError(image) { image.onerror = null; // prevent event bubble image.src = "/images/noimage.gif"; return true; } html 使用 jQuery ```js $("img").error(function () { $(this).unbind("error").attr("src", "broken.gif"); }); //If you use this technique you can use the "one" method to av 继续阅读 »
2017-06-18 MoreFreeze
上一篇 CH31 Basic Regular Expressions /和?,前者向后找,后者向前找 CH32 Case Study: Grep Operator, Part One :nnoremap g :grep -R .可以搜索,表示光标下的单词(包括连字符,比更大),之后可以用:cwindow查看quickfix窗口 以上还有一点要修改,如果光标在一个foo;ls下,使用后实际会执行ls命令,原理和SQL注入类似,所以需要用单引号保证字面值,:nnoremap g :grep -R '' . 但上面对于光标有单引号的不启作用,用:echom shellescape(expand(""))可以显示shellescap 继续阅读 »
2013-05-31 Robert Zhang
分析:按字典序排列的n个单词构成了一个隐式的有向无环图:每个单词单词都有一条出边指向在它字典序之后的每一个单词。要在这张图里找出符合条件的最长路径包含的顶点数。简单的想法就是“暴力”回溯了:对每个顶点进行一次回溯,找出以该点开始的最长的edit step ladder——这个时间复杂度高得能上了火星!思考一下就会发现,回溯包含了大量的重复计算:假设以单词w开始的最长ladder长度为l,那么对于字典中排在w之前的每一个单词(实际上是edit step为1的那些单词),在回溯经过w时都要做同样的重复计算,浪费了大量时间。如果我们计算好了以w开始的最长ladder的长度l,那么对于w的每一个one edit step前驱顶点,其最长la 继续阅读 »
2015-08-09 Klaus Ma
What Is Google C++ Mocking Framework? When you write a prototype or test, often it's not feasible or wise to rely on real objects entirely. A mock object implements the same interface as a real object (so it can be used as one), but lets you specify at run time how it will be used and what it should do (which methods 继续阅读 »