Check palindrome string in java

Palindrome String

In this tutorial we will write different solutions for palindrome string in java. In is one of the questions asked in interviews. What is a palindrome? A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction. Here is an example of palindrome string. … [Read more…]

Convert binary to decimal example in Java

We will convert binary number to decimal using following two methods: Without using Integer.parseInt() Using Integer.parseInt() Write a program to convert binary to decimal without using Integer.parseInt() Output Write a program to convert binary to decimal using Integer.parseInt() Output Integer.parseInt() We used Integer.parseInt() in the second example.  The Javadocs about this method Parses the string argument as a … [Read more…]

Java OOPs interview questions and answers

It is very important to know the concepts of Object Oriented Programming(OOP) before you go for an interview for any of the OOPs languages like Java, C++ or Python.  Here I would be listing the mostly asked OOPs interview questions. And would also explain various OOPs concepts.   1. What is Object Oriented Programming? Object Oriented … [Read more…]

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [ .class]; nested exception is java.lang.ArrayIndexOutOfBoundsException:

Recently we switched from Java 7 to Java 8 and we were using spring 3.1.1. And once we started using the java 8 features in spring beans, we started to encounter the following stacktrace. Solution And the solution to this issue is to upgrade to spring 4.x or don’t use java 8 features in spring … [Read more…]

Updating from spring 3.1 to spring 4.3

Recently I have been working on an application that was using Java 7 and Spring 3.1.1.  And we upgraded from Java 7 to Java 8.  And once we had Java 8 installed, all the spring beans seemed to work fine with spring 3.1.1. But once we started to use java 8 features in Spring beans, … [Read more…]

Increasing Subsequences – Leetcode

Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 Example Input: [4, 6, 7, 7] Output:  [[4, 6], [4, 6, 7], [4, 6, 7, 7], [4, 7], [4, 7, 7], [6, 7], [6, … [Read more…]

Target Sum – Leetcode

Problem You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and – as its new symbol. Find out how many ways to assign symbols to make sum of integers equal to … [Read more…]

Largest Palindrome Product – Leetcode

Problem Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should return the largest palindrome mod 1337. Example: Input: 3  ,  Output: 987 Explanation: 99 x 91 = 9009, 9009 % 1337 = 987 Note:  The range of n is [1,8]. Solution And if … [Read more…]

why string is immutable in java

What is immutable String? String class in java cannot be modified once created.  So let us create two string objects below So once we created the above two strings, the values of these two strings cannot be modified as String class doesn’t provide any method that can allow to modify the value of a String. … [Read more…]