2. /** * A tournament tree is a binary tree * where the parent is the minimum of the two children. * Given a tournament tree find the second minimum value in the tree. * A node in the tree will always have 2 or 0 children. * Also all leaves will have distinct and unique values. * 2 * / \ * 2 3 * / \ | \ * 4 2 5 3 * * In this given tree the answer is 3. */ class Node { Integer value; Node left, right; Node(Integer value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } } class Solution { /** * This should return the second minimum * int value in the given tournament tree */ public static Integer secondMin(Node root) { } }
Software Engineer 2 Interview Questions
665,666 software engineer 2 interview questions shared by candidates
Print a tree level by level
Asked a question to determine the sum of an array of integers. Recursive problem.
Write a program that takes an integer and prints out all ways to multiply smaller integers that equal the original number, without repeating sets of factors. In other words, if your output contains 4 * 3, you should not print out 3 * 4 again as that would be a repeating set. Note that this is not asking for prime factorization only. Also, you can assume that the input integers are reasonable in size; correctness is more important than efficiency. PrintFactors(12) 12 * 1 6 * 2 4 * 3 3 * 2 * 2
They asked to write a function that takes a string and check if it is a number. The second question was given a sorted array that has been rotated, find a number in that array {6,7,1,2,3,4,5}
Basic OOP related questions and Java question about different data structures.
Given a list of buying and selling prices, check if by given a new price will there be any match / transaction. buyer and seller both should get the best prices.
1. Find coordinates of intersection A rectangle is called rectilinear if its edges are all parallel to coordinated axes. Such a rectangle can be described by specifying the coordinated of its lower-left and upper-right corners. Write a function: function solution($K,$L,$M,$N,$P,$Q,$R,$S); that given eight integers representing two rectilinear rectangles (one with lower-left corner (K,L) and upper right corner (M,N), and another with lower-left corner (P,Q) and upper-right corner (R,S)), returns the area of the sum of the rectangles. If the rectangles intersect the area of the intersection should be counted only once. The function should return -1 if the area of the sum exceeds 2,147,483,647. For example Given Integers: K= -4 L = 1 M = 2 N = 6 P = 0 Q = -1 R = 4 S = 3 **the function should return 42** * The area of the First rectangle is 30 and the area of the second rectangle is 16 and the area of their intersection is 4. Assume that * K,L,M,N,P,Q,R and S are integers within the range [-2147483648...2147483647]. * K<M * L<N * P<R * Q<S
a brain teaser question: you have two balls and one 100-story building. What is minimum tries to figure out which floor will break the ball if a ball is dropped from that floor.
given a number, how do you determine if its a power of 3?
Viewing 1401 - 1410 interview questions