Entries from 2017-01-19 to 1 day
problem Given an image represented by an N*N 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? how to solve We swap on each layer, starting from the outermost laye…
Problem There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away. How to solve I…
problem You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method B into A in sorted order. how to solve In this problem, I can use array A which has a large enough buffer at the end t…
problem Implement a MyQueue class which implements a queue using two stacks how to solve I implement two functions pop and push. The first one is getting and removing the oldest element in MyQueue. The second one is adding the element into…