<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[xinxinxv的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/xinxinxv</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; xinxinxv]]></copyright><item><title><![CDATA[宜信电面记录]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/45347527</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/45347527</guid><author>xinxinxv</author><pubDate>Tue, 28 Apr 2015 23:32:06 +0800</pubDate><description><![CDATA[此次电面主要是先自我介绍，然后针对简历上面的项目问了一些基本的问题。考了两个算法题。
第一个是句子翻转， eg "this is right" ---> "right is this"
思路:可以先把字符串整体反转，然后再针对每个单词分别反转。
第二个是数组操作。给定a1, a2, ..., an.
使其输出为 b1 = b3 
这道题也不难，直接相邻数值进行比较就可以。
面试官人很n]]></description><category></category></item><item><title><![CDATA[Q9.11 count the number of ways of parenthesizing the expression]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43236117</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43236117</guid><author>xinxinxv</author><pubDate>Wed, 28 Jan 2015 19:45:53 +0800</pubDate><description><![CDATA[Q:Given a boolean expression consisting of the symbols 0,1, &, /, and A, and a desired boolean result value result, implement a function to count the number of ways of parenthesizing the expression su]]></description><category></category></item><item><title><![CDATA[Q9.10 To build the tallest stack]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43233627</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43233627</guid><author>xinxinxv</author><pubDate>Wed, 28 Jan 2015 17:32:16 +0800</pubDate><description><![CDATA[Q:You have a stack of n boxes, with widths w., heights l\ and depths dr The boxes cannot be rotated and can only be stacked on top of one another if each box in the stack is strictly larger than the b]]></description><category></category></item><item><title><![CDATA[Q9.9 N queens]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43125311</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43125311</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 23:10:28 +0800</pubDate><description><![CDATA[Q: Write an algorithm to print all ways of arranging eight queens on a chess board so that none of them share the same row, column
 or diagonal.
A: 经典的8皇后问题。DFS
#include 
#include 
#include 
using ]]></description><category></category></item><item><title><![CDATA[Q9.8 Combine Sum]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43123061</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43123061</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 22:26:01 +0800</pubDate><description><![CDATA[Q:Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate
 the number of ways of representing n cents.
A:
思路：DFS
例如要构造100]]></description><category></category></item><item><title><![CDATA[Q 9.7 paint fill]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43119175</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43119175</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 20:57:01 +0800</pubDate><description><![CDATA[Q: Implement the “paint fill” function that one might see on many image editing programs. That is, given a screen (represented by
 a 2-dimensional array of Colors), a point, and a new color, fill in ]]></description><category></category></item><item><title><![CDATA[Q9.6 Generate Parentheses]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43115259</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43115259</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 16:11:12 +0800</pubDate><description><![CDATA[Q: 

Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.

EXAMPLE:

input: 3 (e.g., 3 pairs of parentheses)

output: ((())), ((]]></description><category></category></item><item><title><![CDATA[Q9.5 Write a method to compute all permutations of a string]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43114903</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43114903</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 15:29:12 +0800</pubDate><description><![CDATA[Q:Write a method to compute all permutations of a string
A:为了处理方便，下面的代码不是求一个string的全排列，而是求数组的全排列，本质上是一致的
1、如果数据不存在重复。例如[1,2,3]
想要得到全排列，就是要逐位交换。即1与自身交换，然后加上[2,3]的全排列，这只是以1开始的序列；接下来1与2交换，得[2,1,3],如法炮]]></description><category></category></item><item><title><![CDATA[Q9.4 Write a method that returns all subsets of a set.]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43114379</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43114379</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 14:27:40 +0800</pubDate><description><![CDATA[Q:Write a method that returns all subsets of a set.
A:DFS.
#include 
#include 
#include  
using namespace std;

void dfs(const vector &s, int start, vector &path, vector > &res) {
	if (start == s.si]]></description><category></category></item><item><title><![CDATA[Q9.3 Find the magic index]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43113977</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43113977</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 13:31:17 +0800</pubDate><description><![CDATA[Q: A magic index in an array A[1...n-1] is defined to be an index such that A[i] = i. Given a sorted array of distince integers, write a methon to find a magic index, if one exits, in array A。
FOLLOW]]></description><category></category></item><item><title><![CDATA[Q9.2 Find paths]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43112667</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43112667</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 10:49:27 +0800</pubDate><description><![CDATA[Q:
Imagine a robot sitting on the upper left hand corner of an NxN grid. The robot can only move in two directions: right and down. How many possible paths are there for the robot?
FOLLOW UP
Imagin]]></description><category></category></item><item><title><![CDATA[Q9.1 Ruan upp a staircase]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43112523</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43112523</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 10:25:54 +0800</pubDate><description><![CDATA[Q: A child is running up a staircase with n steps, and can hop either 1 step , 2 steps, or 3 steps at a time. Implement a methon to count how mant possible ways the child can run up the staris.
A:斐波那]]></description><category></category></item><item><title><![CDATA[Q5.8 DrawHorizontalLine]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43112279</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43112279</guid><author>xinxinxv</author><pubDate>Sun, 25 Jan 2015 09:18:57 +0800</pubDate><description><![CDATA[Q: A monochrome screen is stored as a singal array of bytes, allowing eight consecutive pixels to be stored in one byte. The screen has width w, where w is a divisible by 8 (that is, no byte will be s]]></description><category></category></item><item><title><![CDATA[Q5.7 Find the missing number]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43031975</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43031975</guid><author>xinxinxv</author><pubDate>Thu, 22 Jan 2015 23:14:16 +0800</pubDate><description><![CDATA[Q: An array A[1…n] contains all the integers from 0 to n except for one number which is missing. In this problem, we cannot access
 an entire integer in A with a single operation. The elements of A a]]></description><category></category></item><item><title><![CDATA[Q5.6  swap odd and even bits]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43026783</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43026783</guid><author>xinxinxv</author><pubDate>Thu, 22 Jan 2015 21:32:20 +0800</pubDate><description><![CDATA[Q:Write a program to swap odd and even bits in an integer with as few instructions as possible (e.g., bit 0 and bit 1 are swapped,
 bit 2 and bit 3 are swapped, etc).
A:将奇数位和偶数位提取出来，再移位取或就可以了
#incl]]></description><category></category></item><item><title><![CDATA[Q5.5  convert integer A to integer B]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43026165</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43026165</guid><author>xinxinxv</author><pubDate>Thu, 22 Jan 2015 21:08:26 +0800</pubDate><description><![CDATA[Q: 

Write a function to determine the number of bits required to convert integer A to integer B.

Input: 31, 14

Output: 2

A: 统计A^B二进制中1的个数就即可。

#include 
using namespace std;

int count_o]]></description><category></category></item><item><title><![CDATA[Q5.4 ((n & (n-1)) == 0).]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43026137</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43026137</guid><author>xinxinxv</author><pubDate>Thu, 22 Jan 2015 21:06:16 +0800</pubDate><description><![CDATA[Q:Explain what the following code does: ((n & (n-1)) == 0).
A: 其作用是判断n是否为0 或者是2的整数幂
因为如果n为2的m次幂的话，那么其二进制表示中只有第m位为1，其余全部为0（从0位开始）]]></description><category></category></item><item><title><![CDATA[Q5.3 Print the next largest and smallest number。 二进制表示中1的个数统计]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/43025171</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/43025171</guid><author>xinxinxv</author><pubDate>Thu, 22 Jan 2015 20:28:17 +0800</pubDate><description><![CDATA[Q:Given an integer, print the next smallest and next largest number that have the same number of 1 bits in their binary representation.
A:
思路1：暴力搜索。统计数字的二进制表示中1的位数。统计方法参考http://blog.youkuaiyun.com/steedho]]></description><category></category></item><item><title><![CDATA[Q5.2 Print the binary representation]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/42977705</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/42977705</guid><author>xinxinxv</author><pubDate>Wed, 21 Jan 2015 20:58:15 +0800</pubDate><description><![CDATA[Q:Given a real number between 0 and 1 (eg.,0.72) that is passed in as a string, print the binary representation.If the number can
 not be represented accurately in binary with 32 characters, print “E]]></description><category></category></item><item><title><![CDATA[Q5.1 Set Bits]]></title><link>https://blog.youkuaiyun.com/xinxinxv/article/details/42977197</link><guid>https://blog.youkuaiyun.com/xinxinxv/article/details/42977197</guid><author>xinxinxv</author><pubDate>Wed, 21 Jan 2015 20:53:14 +0800</pubDate><description><![CDATA[Q:

You are 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 becomes a substring of N located at i and start]]></description><category></category></item></channel></rss>