past

 [迁移自旧博客]
0Monthly 157Total

CareerCup-5.6

Write a program to swap odd and even bits in an integer with as few instructions as possible.

CareerCup-5.5

Write a function to determine the number of bits required to convert integer A to integer B.

CareerCup-5.3

Given an integer, print the next smallest and next largest number that have the same number of 1 bits in their binary representation.

bat实现IP切换

出差调试设备,需要在几个网段之间切换,因此做了个bat实现快速切换。

CareerCup-5.2

Given a number that is passed in as a string, print the binary representation.

CareerCup-5.1

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.

CareerCup-4.6

Design an algorithm and write code to find the first common ancestor of two nodes in a binary tree Avoid storing additional nodes in a data structure.

CareerCup-4.5

Write an algorithm to find the ‘next’ node of a given node in a binary search tree where each node has a link to its parent.

CareerCup-4.4

Given a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth.

CareerCup-4.3

Given a sorted array, write an algorithm to create a binary tree with minimal height.

CareerCup-4.2

Given a directed graph, design an algorithm to find out whether there is a route between two nodes.

CareerCup-4.1

Implement a function to check if a tree is balanced For the purposes of this question.

CareerCup-3.5

Implement a MyQueue class which implements a queue using two stacks.

CareerCup-3.3

Implement a function popAt(int index) which performs a pop operation on a specific sub-stack.

CareerCup-3.2

栈中最小元素。微软实习生一面就遇到了这个问题。

CareerCup-3.1

Describe how you could use a single array to implement three stacks.

CareerCup-2.5

Given a circular linked list, implement an algorithm which returns node at the beginning of the loop.

CareerCup-2.4

Write a function that adds the two numbers and returns the sum as a linked list.

CareerCup-2.3

Implement an algorithm to delete a node in the middle of a single linked, given only access to that node.

CareerCup-2.2

Implement an algorithm to find the nth to last element of a singly linked list

CareerCup-1.8

Assume you have a method isSubstring which checks if one word is a substring of another.

CareerCup-1.7

Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.

CareerCup-1.6

Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees Can you do this in place?

CareerCup-1.3

Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer.

CareerCup-1.1

Implement an algorithm to determine if a string has all unique characters What if you can not use additional data structures?

设计模式[3]-Observer

在对象间定义一对多的依赖关系,这样当一个对象改变状态时,自动通知更新依赖他的对象。