how hashmap works java

HashMap in Java

What is Hashing? Hashing is a mechanism to convert one value to another. The process which performs this transformation is called the ‘Hash Function’. The input to the hash function is normally called as the ‘Key’ and this could be any value which can be converted to a String. The output or the hashed value […]

Read More

Introduction to Design Patterns

What are Design Patterns? What is a Pattern? Patterns exist everywhere in the world. In culinary, art, medicine, law, mathematics, music, dancing and the list goes on. Genrally, a pattern is identified as a recurring arrangement created to solve some generalized problem. It is simply a solution outline. That solution outline can be used over and over […]

Read More

Strategy Design Pattern

Do you Know The Strategy Design Pattern? What is Strategy Design Pattern? Do you use Strategies? We all have dealt with strategies in certain moments of our life. In more technical words strategy is a set of planned actions designed to achieve a specific goal. Simply, you try out many strategies when a final exam […]

Read More

Leetcode – Zuma Game

Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including the leftmost place and rightmost place). Then, if there is […]

Read More

Number Complement – Leetcode

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of a 32-bit signed integer. You could assume no leading zero bit in the integer’s binary representation. Example 1:

Example 2:

  […]

Read More

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