mlblount45
BAN USERBy "well informed" They mean pretend you are a user which is knowledgeable in the material the site is presenting. and By "Objective" they mean a non biased user. For example pretend you are a professional Architect looking to go back to school to further your education and you are opened to any university. This means you are well informed because you are knowledgeable about the field and your are Objective because you are not biased to this school or any other in any way. Hope this helps
 mlblount45 June 18, 2015 override the 'Items' class .compareTo method so Item objects can be compared against one another.
 make sure .compareTo written in descending order
 sort 'items' list using merge sort algorithm.
 return items.get(i).itemId.
Time complexity: O(n log n)
Space complexity: O(n)
 override the 'Items' class .compareTo method so Item objects can be compared against one another.
 make sure .compareTo written in descending order
 sort 'items' list using merge sort algorithm.
 return items.get(i).itemId.
Time complexity: O(n log n)
Space complexit: O(n)
This seems overly complicated what benefit are you getting from having the heap in your solution? Are you saying your find() method runs in O(nlogn)? if this is the case then why not just sort in decreasing order and then return the ith location.
 mlblount45 May 28, 2015package com.blountmarquis.CareerCupQuestions;
/**
* Created by mlblount on 5/28/2015.
*/
public class MatrixPath {
public static boolean isPathExist(int[][] matrix, Position start, Position end){
if(start.row < 0  start.row >= matrix.length) return false;
if(start.col < 0  start.col >= matrix[0].length) return false;
return search(matrix, start, end);
}
private static boolean search(int[][] matrix, Position location, Position end) {
if(location == null) return false;
if(location.equals(end)) return true;
matrix[location.row][location.col] = 1;
Position moveUp = moveUp(matrix, location);
Position moveRight = moveRight(matrix,location);
Position moveDown = moveDown(matrix,location);
Position moveLeft = moveLeft(matrix,location);
return search(matrix,moveDown,end)  search(matrix, moveLeft, end) 
search(matrix, moveRight, end)  search(matrix,moveUp, end);
}
private static Position moveLeft(int[][] matrix, Position location) {
int keep = location.row;
int move = location.col  1;
if(move < 0  matrix[keep][move] != 0) return null;
return new Position(keep,move);
}
private static Position moveDown(int[][] matrix, Position location) {
int move = location.row + 1;
int keep = location.col;
if(move >= matrix.length  matrix[move][keep] != 0) return null;
return new Position(move,keep);
}
private static Position moveRight(int[][] matrix, Position location) {
int keep = location.row;
int move = location.col + 1;
if(move >= matrix[0].length  matrix[keep][move] != 0) return null;
return new Position(keep,move);
}
private static Position moveUp(int[][] matrix, Position location) {
int move = location.row  1;
int keep = location.col;
if(move < 0  matrix[move][keep] != 0) return null;
return new Position(move,keep);
}
public static void main(String[] args){
int[][] matrix = new int[][]{
{0,0,1,0,1},
{0,0,0,0,0},
{0,1,1,1,1},
{0,1,1,0,0},
{0,0,0,0,0}
};
Position start = new Position(1,4);
Position end = new Position(3,0);
System.out.println("is path exist? : " + MatrixPath.isPathExist(matrix,start,end)); //output true
start = new Position(0,0);
end = new Position(2,1);
System.out.println("is path exist? : " + MatrixPath.isPathExist(matrix,start,end)); //output false
}
private static class Position {
int row;
int col;
public Position(int x, int y){
this.row = x;
this.col = y;
}
public Position(Position p){
this.row = p.row;
this.col = p.col;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Position)) return false;
Position position = (Position) o;
if (col != position.col) return false;
if (row != position.row) return false;
return true;
}
@Override
public int hashCode() {
int result = row;
result = 31 * result + col;
return result;
}
}
}

mlblount45
May 28, 2015 since the question ask for the min value not in the list i believe the example given is wrong the answer given is 22 but it should be 24 since 24 < 23. With that said your solution would be correct if you replaced
min + 1
with
min  1

mlblount45
May 27, 2015 Do as many Mock interviews with friends as possible. Treat these interviews as if they were the real thing code on whiteboard etc.
 mlblount45 May 21, 2015I thought of taking the average of K picks then multiplying by 2 to get the total count estimate. My thought was this average would give a close approximation of the actual average. This average would be only half of the value we are looking for so multiplying by 2 will give us the total count
Code below:
public int getNumberOfBallsEtimate(int[] bag, int k){
//error checking here...
int val = 0;
for(int i = 0; i < k: i++){
val += getPickFromBag(bag);
}
int average = val/k; //is currently the aver
int countEstimate = average/2;
return countEstimate;
}
All, please give feed back on this approach
 mlblount45 May 21, 2015public static void main(String[] args){
String date = "12312015";
DateCalculator dateCalculator = new DateCalculator();
System.out.println("Number of Days is: " + dateCalculator.dateToDays(date));
}
public class DateCalculator {
public int dateToDays(String date) {
String[] dateArr = date.split("");
if(dateArr.length != 3)
throw new DateException();
int month = Integer.parseInt(dateArr[0]);
int day = Integer.parseInt(dateArr[1]);
int year = Integer.parseInt(dateArr[2]);
int monthInDays = convertMonthToDays(month, year);
return day + monthInDays;
}
private int convertMonthToDays(int month, int year) {
int monthsToCount = month  2;
int numOfDays = 0;
boolean isLeapYear = Year.isLeapYear(year);
while (monthsToCount >= 0){
numOfDays += Month.getDaysInMonth(monthsToCount);
monthsToCount;
}
if(isLeapYear && month > 2){
return numOfDays + 1;
}
return numOfDays;
}
}
public class Year {
public static boolean isLeapYear(int year) {
if(year % 4 != 0)
return false;
if(year % 100 != 0)
return false;
if(year % 400 != 0)
return false;
return true;
}
}
public class Month {
private static final int[] months = new int[]{31,28,31,30,31,30,31,31,30,31,30,31};
public static int getDaysInMonth(int month) {
if(month < 0  month > 11) throw new DateException();
return months[month];
}
}
public class DateException extends RuntimeException {
public DateException(){
super();
}
}

mlblount45
March 19, 2015 Open Chat in New Window
I should also add, don't be afraid to ask questions for clarification. This is something you should also be doing during the interview.
 mlblount45 June 18, 2015