Max Consecutive Ones – Leetcode

Given a binary array, find the maximum number of consecutive 1s in this array. Example 1:

Note: The input array will only contain 0 and 1. The length of input array is a positive integer and will not exceed 10,000   Solution This is an easy to solve problem. We keep on counting the ones till a […]

Read More

Construct the Rectangle Leetcode

Given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

You need to output the length L and the width W of the web page you designed in sequence. Example:

  Note: The given area […]

Read More

How to find a word inside a folder recursively in linux?

This can be done using grep command.

If you are searching in current directory use dot(.) as shown below

Options we have used -n                   : Show relative line number in the file -r                    :  Recursively […]

Read More

Unsupported major.minor version 52.0

Recently we migrated to Java 8 from Java 7. And after installing Java 8 on my system, running any test threw the exception

And the solution for me was to run Maven > Update Project from context menu. You can also update the classpath of your project from command line using the following command […]

Read More

Binary Tree Paths

Problem Given a binary tree, return all root-to-leaf paths. Define a tree with left and right nodes

Create Binary Tree and print path

Read More

Convert an Image to base64 string in java

Read More

Geowave queries: Querying by polygon, Filtering on attributes of features using CQL queries, Ingesting polygons, and running polygon intersect queries

Read More

ArrayList in java , add() method

Here is a real world example of using java.util.ArrayList add method.

Read More