• 21 October

    How to convert Byte Array to String in java

    Sometimes, we may need to convert String to bytes Array but how to convert bytes array to String back. toString method does not work correctly here as it just print bytes in String format. You can use String’s constructor to get String back. Example: [crayon-66347bd854301253402912/] When you run above program, you will get below output: […]

  • 19 October

    Exception handling in java

    Exceptions I have started writing about the and how to prepare for the various topics related to OCAJP exams in my blog. In my previous post, I have published few sample mock questions for StringBuilder class. In this post I am going to explain about the another OCAJP exam objective “Differentiate among checked exceptions, unchecked […]

  • 12 October

    Implement Queue using Linked List in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post , we will see how to implement Queue using Linked List in java. Queue is abstract data type which demonstrates First in first out (FIFO) behaviour. We will implement same behaviour using Array. Although java provides implementation […]

  • 10 October

    Convert sorted Linked List to balanced BST

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post , we will see how to convert sorted LinkedList to balanced binary search tree. There are two ways to do it. Solution 1: It is very much similar to convert sorted array to BST. […]

  • 24 September

    Java Program to Find Second Largest Number in An Array

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. 1. Overview In this post, we will see how to find the second largest number in an array. This is a one of common interview questions on array data structure. 2. Introduction to Problem Statement Given […]

  • 20 September

    Find length of Linked List in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm programs. In this post, we will see how to find length of Linked List in java. You can obviously use size() method of java Linked List class but here we are going to see how to find length […]

  • 20 September

    Implement singly linked list in java

    In this post, we will see how to implement singly linked list in java. It is one of the most used data structure. In singly linked list, Node has data and pointer to next node. It does not have pointer to the previous node. Last node ‘s next points to null, so you can iterate […]

  • 16 September

    Java Program to Find Missing Number in An Array

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. 1. Overview In this article, we will see how to find missing number in Array of 1 to n. This is one of basic coding interview question asked in my interviews. 2. Introduction to Problem Statement […]

  • 15 September

    Longest Common Prefix in an array of Strings in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we are going to see longest common prefix in array of Strings. So lets say you have string array as below: [crayon-66347bd8575ff717889826/] So Longest common prefix in above String array will be “java” […]