## ♦ Ensuring code quality in Java Q&As

Q1. How do you ensure code quality in your application? A1. Code quality means writing readable, maintainable and robust code, that conforms as much as possible to the style-guideline that is used, and that has as little as possible defects. It also means writing maintainable code with proper automated and…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Code Quality, Coding, FAQs Code Quality, member-paid

## ♦ 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, second number being…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid

## ♦ Finding the perfect number

Q. Can you write code to output the perfect number between a given range? Definition: A perfect number is a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid

## ♦ Iteration Vs Recursion

Q1. Can you write a sample code that will count the number of “A”s in a given text “AAA rating“? Show both iterative and recursive approaches? A1. Iteration: Recursion: A re-entrant method would be one that can safely be entered, even when the same method is being executed, further down…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid

## ♦ Palindrome

Q1. Can you write a function to determine if a given string input is a palindrome? A palindrome is a word or sentence that reads the same forward as it does backward. For example, the terms “racecar”, “dad”, “madam” and the name “Hannah”. The longest palindromic substring of “bananas” is…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid

## ♦ Reverse a given String

Q1. Can you write a method that reverses a given String? A1. Can be done a number of different ways. Best Practice: Using the Proven Java API It is always a best practice to reuse the API methods as shown above with the StringBuilder(input).reverse( ) method as it is fast,…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid

## ♥ 30+ Java Code Review Checklist Items

This Java code review checklist is not only useful during code reviews, but also to answer an important Java job interview question, Q. How would you go about evaluating code quality of others’ work? You also learn a lot from peer code reviews. What has been written well? Why was

Posted in Code Quality, Coding, FAQs Code Quality

## ♦ 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, make sure that your code fails fast.

Posted in Can you write code?, Coding
Tags:

## ♦ 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. Solution 2: Sort the numbers and…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home

## ♦ 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…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home

## ♦ Is it a valid binary search tree (BST) ?

Q. Write code test if a given tree is a binary search tree (i.e. BST)? A. A binary search tree (BST) is a binary tree where each node satisfies the following conditions: 1) key in any node is larger than the keys in all nodes in that node’s left subtree…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Coding, member-paid, Tree structure

## 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, which…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, Java 8, member-paid

## 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

Posted in Can you write code?, Coding, Java 8, OOP

## 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, there will be many repeats.…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, FP, Java 8, member-paid

## Fizz Buzz

Q1. Write a program that prints numbers from 1 to 30, but for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”? A1. This is a very basic coding question,…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Can you write code?, Coding, member-paid
Page 1 of 212