Category Archives: Interview Questions

Interview Question – 12 – Bon Appétit

By | November 16, 2018

Question You can download the problem statement from here. Solution [java] static void bonAppetit(List<Integer> bill, int k, int charged) { int actualBill = 0; int payBill = 0; int size = bill.size(); for(int i = 0; i < size; i++) { actualBill += bill.get(i); } payBill = actualBill – bill.get(k); payBill = payBill/2; print("Actual Bill : " +… Read More »

Interview Question – 9

By | October 15, 2018

Question Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of times she breaks her season record for most points and least points in a game. Points scored in the first game establish her record for the season, and she begins counting from there. For… Read More »

Interview Question & Answer – 9

By | October 10, 2018

Question Given a time in -hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Sample Input 07:05:45PM Sample Output 19:05:45 Solution [java] static String timeConversion(String s) { String time24 = null;… Read More »

Interview Question & Answer – 7

By | October 5, 2018

Question Write a recursive program to count the number of “a”s in a string. Solution [java] package com.test; public class CountAs { static int countA(String str) { if (str.length() == 0) { return 0; } int count = 0; if (str.substring(0, 1).equals("a")) { count = 1; } return count + countA(str.substring(1)); } public static void main(String[] args) {… Read More »

Interview Question & Answer – 6

By | October 4, 2018

Question Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix is shown below: 1 2 3 4 5 6 9 8 9 Ans : | (1+5+9) – (3+5+9) | = 2. Solution [java] static int diagonalDifference(int[][] arr) { int diagonalSum1 = 0; int diagonalSum2 = 0; int length… Read More »

Interview Question & Answer – 5

By | October 3, 2018

Question Alice and Bob each created one problem for our company. A reviewer rates the two challenges, awarding points on a scale from to for three categories: problem clarity, originality, and difficulty. We define the rating for Alice’s challenge to be the triplet , and the rating for Bob’s challenge to be the triplet . Your task is… Read More »

Interview Question & Answer – 4

By | October 2, 2018

Question Lilah has a string, , of lowercase English letters that she repeated infinitely many times. Given an integer, , find and print the number of letter a’s in the first letters of Lilah’s infinite string. For example, if the string and , the substring we consider is , the first characters of her infinite string. There are… Read More »

How to find your Google Plus ID

By | September 27, 2012

This is so simple 1. Go to your Google + account (https://plus.google.com/). 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this: https://plus.google.com/104653270154306099169/posts 4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven’s from the URL above:… Read More »