DataStructures_Algorithm
数据结构与算法
冰河映寒星
知乎:冰河映寒星
分享自己的机器学习笔记,包括知识点面经、NLP、推荐系统等等,新手的学习笔记,督促自己巩固与学习。
展开
-
LeetCode - 27: Remove Element
27、Remove ElementGiven an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modif...原创 2018-04-30 13:57:54 · 162 阅读 · 0 评论 -
LeetCode - 35: Search Insert Position
35、Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no...原创 2018-04-30 18:55:53 · 158 阅读 · 0 评论 -
LeetCode - 1: Two Sum
1、Two SumGiven 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, and you may not us...原创 2018-04-28 08:45:14 · 159 阅读 · 0 评论 -
LeetCode - 26: Remove Duplicates from Sorted Array
26、Remove Duplicates from Sorted ArrayGiven a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for an...原创 2018-04-28 10:17:11 · 149 阅读 · 0 评论 -
剑指Offer:二维数组中的查找
在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。public boolean Find(int target, int[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length ...原创 2018-08-13 15:32:20 · 174 阅读 · 0 评论 -
剑指Offer:替换空格
请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。Python:# -*- coding:utf-8 -*-class Solution: # s 源字符串 def replaceSpace(self, s): # write code here ...原创 2018-08-13 15:46:16 · 152 阅读 · 0 评论 -
剑指Offer:从尾到头打印链表
输入一个链表,按链表值从尾到头的顺序返回一个ArrayList。import java.util.ArrayList;import java.util.Collections;public class Solution { public ArrayList<Integer> printListFromTailToHead(ListNode listNode) { ...原创 2018-08-13 16:00:48 · 150 阅读 · 0 评论 -
荷兰国旗问题
package Some_Algorithm;/** * Author: songpo.zhang * Date: 2018/8/29 * Target: * 荷兰国旗问题 */public class NetherlandsFlag { /** * * @param arr * @param num */ publi...原创 2018-08-29 20:15:30 · 193 阅读 · 0 评论