09 2016 档案
摘要:1. Weak references: In computer programming, a weak reference is a reference that does not protect the referenced object from collection by a garbage
阅读全文
摘要:1. How would you write a socket client/server in Java The Client side: 2. Main Differences Betwen Java NIO and IO: IO NIOStream oriented Buffer orient
阅读全文
摘要:1. HashMap vs HashTable vs ConcurrentHashMap 1). Thread -Safe : ConcurrentHashMap is thread-safe that is the code can be accessed by single thread at
阅读全文
摘要:Mutexes, ReadWriteLock, ArrayBlockingQueue, Thread pools, LinkedList vs ArrayList, Object Pooling, Read-Modify-Write, java.util.concurrent, java.util.
阅读全文
摘要:1.Implement a thread-safe (blocking) queue: 2. Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing
阅读全文
摘要:1. Dependency Injection Answer: Any application is composed of many objects that collaborate with each other to perform some useful stuff. Traditional
阅读全文
摘要:标签: 前端学习笔记 今天开始学习react.js特开这一篇随笔作为react的学习笔记,主要记录看到的重点内容和自己的心得感想: 一. 基本组件和方法 1.reactjs引入了一个虚dom的概念,对于每一个dom点都会存在一个状态,如果这个dom上的属性发生了改变,在react中如果发生了变化:首
阅读全文
摘要:Design Patterns (Factory, Abstract Factory, singleton, DAO, Proxy): 1. Factory: In Factory pattern, we create object without exposing the creation log
阅读全文
摘要:标签: 动态规划 题目描述: There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color i
阅读全文
摘要:标签: 动态规划 描述: Find the contiguous subarray within an array (containing at least one number) which has the largest product. Find the contiguous subarray
阅读全文
摘要:标签:动态规划 题目描述: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Example For example, g
阅读全文
摘要:标签: 动态规划 解题思路 1. 这道题最重要的是,存在三个字符串,但是并不需要两个二维矩阵来进行解,因为可以使用i+j-1来代表s3的下标,这样就可以通过i和j来遍历s3了。因为对于任何一个合法的交叉字符串都会有,s3(i+j-1)=s1(i-1) 或者s3(i+j-1) = s2(j-1) 2.
阅读全文
摘要:标签:动态规划 描述: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step
阅读全文
摘要:标签:动态规划 题目描述: Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is
阅读全文
摘要:标签: 动态规划 问题描述: There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no mor
阅读全文
摘要:标签: 动态规划 描述: Given an integer array nums with all positive numbers and no duplicates, find the number of possible combinations that add up to a positi
阅读全文
摘要:标签:动态规划 问题描述: Given n items with size Ai and value Vi, and a backpack with size m. What's the maximum value can you put into the backpack? 解题思路: 又是一道恶
阅读全文
摘要:标记: 动态规划 问题描述: Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack? Example If we have 4 item
阅读全文
摘要:标签: 动态规划 描述: Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification
阅读全文
摘要:标签:动态规划 题目描述: Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. 解题思路: 这一题是非常经典的动态规划问题,在解题思路上可以按
阅读全文
摘要:背包问题: 又是经历了一个非常痛苦的阶段,终于解决了一个非常简单而经典的动态规划问题。 问题描述: 一个旅行者随身带一个背包。可以放背包的物品有n种,每种物品的重量和价值分别为w和v。背包的最大重量限制是b,每种物品可以放多个,怎么放可以使背包价值最大? 思路: 1. 这一道问题属于线性规划问题:由
阅读全文
摘要:投资问题: 问题描述:有m元钱,投资给n的项目,f(x): 将x元投入到第i个项目中的效益。求使得总效益最大的投资方案。(这道题太不容易了,这是我第一次没有看答案做出了动态规划的问题,应该是花了三个小时)。 建模:问题的解是向量<x1,x2,xn> 目标函数:max{f1(x1)+f2(x2)+fn
阅读全文
摘要:众所周知,在面试中最难,也是大公司最容易考的就是动态规划,所以今天打算开撕动态规划,之前只是对于单个的题目知道解法,不过时间一久就忘记了,今天开始要彻底的理解方法论再到实践,希望老天保佑能够一周搞定! 一.通过一个小例子了解方法论: 一个例子,如上图: 求从起点到终点的最短路径: 这是一道最基本的动
阅读全文
摘要:标签: 位运算 描述: Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M
阅读全文
摘要:标签: 位运算 描述 Write a function that add two numbers A and B. You should not use + or any arithmetic operators. 解题思路: 利用位运算来解决A+B的问题,可以将此问题转化为解决不进位相加和进位(c
阅读全文
摘要:标签: 位运算 描述: Count how many 1 in binary representation of a 32-bit integer. 解题思路: 统计一个int型的数的二进制表现形式中1的个数1.与check power of 2中的解题形式非常相似,同样利用num&(num-1)
阅读全文
摘要:标签: 位运算 题目: Using O(1) time to check whether an integer n is a power of 2. 解题思路: 这道题是利用位运算判断一个数是不是2 的整数次方思路:1. 如果一个数是2的整数次方的话,那么他的二进制表现形式上只有一位是1,其余的都会
阅读全文
摘要:Flip Bits: 标签:位运算 题目:Determine the number of bits required to flip if you want to convert integer n to integer m. 解题思路: 给出两个数字a和b,返回两个数字中需要转换的内容这道题主要是
阅读全文

浙公网安备 33010602011771号