Essa empresa é sua?
1. Finding first non repeated character in an array 2. Linux command to list files containing specific string 3. Mysql query related to Group by Second phone interview 1. create a doubly linked list out of that tree where each node represents sum of all nodes in the same vertical line. 2. Implement search for a sorted rotated array.
Sigiloso
public class Solution { /** *@param A : an integer rotated sorted array *@param target : an integer to be searched *return : an integer */ public int search(int[] A, int target) { // write your code here if(A == null || A.length == 0){ return -1; } int start = 0; int end = A.length - 1; int mid; while(start + 1 < end){ mid = start + (end - start) / 2; if(A[mid] == target){ return mid; } if(A[start] < A[mid]){ if(A[start] <= target && target <= A[mid]){ end = mid; }else{ start = mid; } }else{ if(A[mid] <= target && target <= A[end]){ start = mid; }else{ end = mid; } } } if(A[start] == target){ return start; }else if(A[end] == target){ return end; }else{ return -1; } } }