Tech

Polymorphism in Java

Just revisiting and explaining myself Polymorphism concept here through a blog post. The words Polymorphism means multiple forms. In Java ,Polymorphism means multiple forms of an object. We shall divide this article into 3 sections. 1.Syntax 2.Calling a variable polymorphically. 3.Calling a method polymorphically. 1.Syntax Now in polymorphism in Java, the thumb key rule to…

Tech

Constructors in Java

Constructors are used every time to initialize instance variables. There are some additional rules associated with constructors that are often asked in interviews.Hence revising those here through a blog post. 1.A constructor is used to initialize instance variables. 2.When an object of an class is created,JVM goes to the class and searches for that matching…

Tech

with_options in rails

I have recently encountered this method, which saved my time and helped me follow the DRY principle Use case: Consider a scenario, you have a list of trains and you have to apply filters on like depature_time, arrival_time, train_number, arrival_station, depature_station, number of coaches, etc. For that, you have to write interaction. The input will…

Tech

Configuring Debugger for Jruby in vscode

Recently, I configured a debugger for my jruby application on VScode. I have spent almost 1 day on this and few posts discuss this issue. My jruby version is 9.2.9.0. so I can guarantee the following steps definitely will work for this version. Step 1: Install debug related gems Step 2: Configuring launch.json Create a…

Tech

How Recycler view works in android

I recently did a mini-project Quote app, I used listview for that. The project started consuming lots of memory and CPU whenever I scroll through the quotes. After reading few articles and watching videos. I realized there is a better way to show a list in android, which is Recycler View. In this post, we…

Tech

How to create resume as node library

So I recently saw a linkedin post where the guy created his resume using node js module. So if you wanna impress your recruiter or interviewer you can just share your npm package. This have become easy because we have a library which already provide with the template, we just have to populate the data….

Tech

How to use SSH public key authentication

One of the ways to access a remote server is using a ssh with password and another cool way is to use public-key authentication where you don’t need to type a password along with that we store necessary details in ~/.ssh/config so that with minimal keystroke we will be able to access the remote server….

Leetcode

Out of Boundary Paths

Problem Statement: https://leetcode.com/explore/challenge/card/june-leetcoding-challenge-2021/606/week-4-june-22nd-june-28th/3790/ After solving a few similar problems, I see a pattern here. Whenever you want to do an exhaustive search. First write a recursive brute force solution, which will definitely fail because of high time complexity. After that memorize the answer for a state so you don’t have to calculate a particular cell…

Leetcode

Pascal’s Triangle

Problem Statement The logic is in the above gif itself. We have to do the following things.1. Hardcode 1 at 0th and last position of every row.2. If we are at the ith row and jth column. We can get the value of pascal[i][j]. pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];

Pages