[LeetCode]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
                   ↘
                     c1 → c2 → c3
                   ↗            
B:     b1 → b2 → b3

begin to intersect at node ...

继续阅读

jQuery校验文本框只允许输入数字[0-9]

下面的代码片段通过前台校验限制HTML文本框只允许输入数字[0-9]

JavaScript代码如下:

$(document).ready(function() {
    $("#txtboxToFilter").keydown(function (e) {
        // Allow: backspace, delete, tab, escape, enter and .
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
             // Allow: Ctrl+A
            (e.keyCode == 65 && e.ctrlKey === true) || 
             // Allow ...

继续阅读

Python非递归算法求解Fibonacci斐波那契数列

斐波那契数列递归数学定义如下:F0=0,F1=1,Fn=F(n-1)+F(n-2)(n>=2,n∈N*)

Python代码:

函数f(n),输入非负整数n,返回f[n] 

def f(n):
    a, b = 0, 1
    for i in range(0, n):
        a, b = b, a + b
    return a ...

继续阅读

怎样实现在家编程谋生[StackOverflow问答]

16年来我辗转3个国家,一直在从事全职程序员的工作。这段经历比较有趣(但并不是那么有趣)。现在,我不想再过每天上下班的上班族生活了,而是想呆在家里养活自己。我的想法是从这个星球上任何地方的一家公司接项目(我现在住在澳大利亚布里斯班,这里远程工作的机会不太多)。雇主会为根本不需要看到我而感到高兴的。

There's the obvious parallel with contributing to open source projects, though I'm specifically looking for paying jobs; this would become my primary source of income, rather than a volunteer ...

继续阅读

面向对象编程语言的特征比较

Many languages claim to be Object-Oriented. While the exact definition of the term is highly variable depending upon who you ask, there are several qualities that most will agree an Object-Oriented language should have:

许多编程语言声称自己是面向对象的(Object-Oriented)。但当询问“面向对象”的确切定义时,不同的人的答案区别很大,下面列举几条大家公认的,面向对象语言所应具有的性质 ...

继续阅读