摘要: /* Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1 阅读全文
posted @ 2017-09-30 09:00 Tom_NCU 阅读(90) 评论(0) 推荐(0)
摘要: /* Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last w 阅读全文
posted @ 2017-09-30 07:55 Tom_NCU 阅读(71) 评论(0) 推荐(0)
摘要: The Multiclass SVM loss for the i-th example is then formalized as follows: The most common regularization penalty is the L2 norm that discourages lar 阅读全文
posted @ 2017-09-29 21:09 Tom_NCU 阅读(236) 评论(0) 推荐(0)
摘要: discussion: 题目类似字符串匹配,可参考KMP算法 https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm 阅读全文
posted @ 2017-09-29 17:54 Tom_NCU 阅读(93) 评论(0) 推荐(0)
摘要: 解决思路: 使用迭代器遍历vector,非重复时 length++,删除重复元素。 discuss: 题意不考虑vector中length之后的值,可以不做删除,选择覆盖前length 个元素 。稍快于解法1 阅读全文
posted @ 2017-09-29 17:48 Tom_NCU 阅读(83) 评论(0) 推荐(0)
摘要: /* Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. */ class Solution { public: ListNode* mergeTwoL... 阅读全文
posted @ 2017-09-29 17:42 Tom_NCU 阅读(72) 评论(0) 推荐(0)