1 2 3 4

## 05: Finding the 2nd highest number in an array

Requirements gathering Does the array allow duplicates? If duplicates are allowed, then do you need to report duplicates? For example, in {2,4, 6, 3, 6, 5}, is 6 or 5 the second highest? Analysis If duplicates are not allowed, sort the array (Arrays.sort(…)) and get the second last element, …...

###### Members Only Content
Log In Register Free Q&As

## 08: Write code to add, subtract, multiply, and divide given numbers?

A trivial coding example (i.e. a Calculator) tackled using the following programming paradigms in Java not only to perform well in coding interviews, but also to learn these programming paradigms.

Approach 1: Procedural Programming
Approaches 2 – 4: Object Oriented Programming
Approach 5: Functional Programming (Java 8)

Approach 1: Procedural

Output: result=13

Approach 2: OOP

When you have more mathematical operations,

Read more ›

## 17 Java Coding Tips for job interviews and pre-interview coding tests

Java coding questions are very common in job interviews. Good coding skills are essentials for passing the peer code reviews with flying colors. Here are 17 coding tips with Java examples. Tip #1: If you are asked to write a function or code, … Read more ›...

###### Members Only Content
Log In Register Free Q&As

## Fibonacci number

Q1. Can you write a function to determine the nth Fibonacci number? The Fibonacci numbers under 2000 are : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597. Where the zeroth number being 0, first number being 1, … Read more...

###### Members Only Content
Log In Register Free Q&As

## Fibonacci number with caching and Java 8 FP

Complimenting Fibonacci number coding – iterative and recursive approach, we can improve performance by caching. If you run this Output and you can see “fibonacci(3)” is repeated 2 times, “fibonacci(2)” is repeated 3 times, and so on. If you pick a larger number like 21, … Read more ›...

###### Members Only Content
Log In Register Free Q&As

## Find 2 numbers from an array that add up to the target

Q1. Given an array of integers, find two numbers such that they add up to a specific target number? For example, Given numbers: {2, 3, 8, 7, 5} Target number: 9 Result: 2 and 7 A1. Solution 1: Store processed numbers in a set. … Read more ›...

###### Members Only Content
Log In Register Free Q&As

## Find the first non repeated character in a given string input

Pseudocode 1) Precodnition check for null or empty input. 2) Loop throught the input string, and store each “character” as a key in a map with the value being the “character count”. For example, an input string of “stress” would have Key –Value s -3 t -1 r -1 e...

###### Members Only Content
Log In Register Free Q&As

1 2 3 4
Note that some posts belong to multiple categories.
Top 