摘要:
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 当然还有更逆天的算法,来自dis 阅读全文
摘要:
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文
摘要:
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. Example: 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 题目的描述很简单,就是求多个字符串公共前缀,其实可以考虑先对字符向量用sort()进行排序,然后从前向后遍历,复杂度为O(S) 阅读全文
摘要:
本文是根据Coursera上吴恩达老师深度学习视频整理而成的笔记,包含课程所有精华内容,对深度学习感兴趣的同学还是推荐看看吴恩达老师的课程视频,讲解深入浅出,很适合作为入门教材,课程视频请在coursera官网或者网易云课堂观看。 一、误差分析 定义:有时我们希望算法能够胜任人类能做的任务,但是当算 阅读全文
摘要:
前言 C++11这次的更新带来了令很多C++程序员期待已久的for range循环,每次看到javascript, lua里的for range,心想要是C++能有多好,心里别提多酸了。这次C++11不负众望,再也不用羡慕别家人的for range了。 使用场景ex1:遍历字符串 遍历str,输出每 阅读全文
摘要:
1. K-NN算法简介 K-NN算法 ( K Nearest Neighbor, K近邻算法 ), 是机器学习中的一个经典算法, 比较简单且容易理解. K-NN算法通过计算新数据与训练数据特征值之间的距离, 然后选取 K (K>=1) 个距离最近的邻居进行分类或者回归. 如果K = 1 , 那么新数 阅读全文
摘要:
排序算法一般都是笔试和面试中的重点,这里我们简单简单总结一下常用的排序算法——快速排序 快速排序在一趟排序中将数字分割成为独立的两部分,左边一部分小于轴值,右边一部分大于轴值,轴值的选择理论上可以选择数组中的任何一个数组,我们在这里考虑选择第一个数字。然后对两部分序列重复进行上述操作,快速排序可以用 阅读全文
摘要:
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except 阅读全文
摘要:
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascend 阅读全文