The array reference here is passed by value to the methods below. This is similar to what we usually see in case of Javascript. Arrays Objects The following program to print kth last element in a linkedlist, demonstrates… Read more →
Category: interview
-
Javascript call() vs apply() vs bind()
call The call() is a predefined Javascript function which can used to call a method of an object while passing it another object. For example, if you look at the following code, you will observe that the object… Read more →
-
Passing an object vs primitive data type in Js
In Javascript, when you pass a primitive data type like String or Int in Java to a function or a method, and a function modifies it, then this does not effect the actual data being passed. For example,… Read more →
-
Floyd Warshall Algorithm
The Floyd Warshall Algorithm is used to find the shortest distance between all pairs in a weighted graph with positive or negative edges. It makes use of Dynamic Programming. If A, B, C are vertices, then this algorithm… Read more →
-
Kth largest element in an Array
Kth largest element in an array can be determined using the "Quickselect Algorithm". Average performance O(n)Worst-case performance O(n^2) Demo Using Min Heap Read more →
-
Front End Engineer Interview Prep
Classical Inheritance vs Prototypal Inheritance The difference between classical inheritance and prototypal inheritance is that classical inheritance is limited to classes inheriting from other classes while prototypal inheritance supports the cloning of any object using an object linking… Read more →
-
What to consider when accepting a job offer
There are a lot of things to consider other than compensation, when accepting an offer especially in the Software Industry. Some of them are Paid Vacation Health & Dental Benefits 401k Relocation Signup bonus Annual bonus Stock options… Read more →
-
Move Zeroes to the front of an Integer Array
Given an array of integers, move all the zeroes to the beginning of the array, leaving the order of the other integers unaltered. This operation has to be done in place. Time Complexity O(n) Java Output JavaScript Demo… Read more →
-
Maximum Water Capacity in a Histogram
Calculate the maximum amount of water that can held within a bar graph without overflow. The amount of water that can be held at any point is the difference of the minimum of the maximum of left bars… Read more →
-
Find the maximum product of 3 integers in a list
The following code handles negatives as well. Time Complexity O(n) Space Complexity O(1) Code Output Read more →