Jewels and Stones

Question You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so “a” is considered a different type of stone from “A”. [Read More]

Testing Alexa (Amazon Echo) weather application

Question You’re a test engineer at Amazon working with the team who creates skills on Alexa (Amazon Echo). Your team has created a “weather” skill where you can ask Alexa about the weather and it responds with relevant information. How would you test this skill? What would your test cases be? Answer Test automation is possible here and efficient if we automate on the data layer. Before you start answering the questions, you should ask questions to limit your scope of the problem domain. [Read More]

Java program to push zeroes to the end of the array

Problem Given an array of random numbers, push all the zeroes of a given array to the end of the array. Solution We will iterate through the array and move all non zero elements to the front first. We will then fill the remaining array elements with zeroes until we reach the end of the array. Complexity: O(n) package com.interview.prep.programs; public class MoveZeroesToTheEndOfTheArray { public int[] moveZeroes(int[] numbers) throws Exception { if (numbers ! [Read More]