Interview

Find out the Longest Path in a matrix

Find out the Longest Path in a matrix

Given an m-by-n matrix with positive integers, determine the length of the longest path of increasing within the matrix. For example, consider the input matrix:[1 2 34 5 67 8 9] The answer should be 5 since the longest path would be 1-2-5-6-9 def isValid(mat, i, j): return 0 <= i < len(mat) and 0 <= j < len(mat) def findLongestPath(mat, i, j): if not isValid(mat, i, j): return [] path = [] if i > 0 and mat[i - 1][j] - mat[i][j] == 1: path = findLongestPath(mat, i - 1, j) if j + 1 < len(mat) and mat[i][j…
Read More
Explain the central limit theorem and give examples of when you can use it in a real-world problem.

Explain the central limit theorem and give examples of when you can use it in a real-world problem.

The center limit theorem states that if any random variable, regardless of the distribution, is sampled a large enough time, the sample mean will be approximately normally distributed. This allows for studying the properties of any statistical distribution as long as there is a large enough sample size. Important remark from Adrian Olszewski:⚠️ we can rely on the CLT with means (because it applies to any unbiased statistic) only if expressing data in this way makes sense. And it makes sense *ONLY* in the case of unimodal and symmetric data, coming from additive processes. So forget skewed, multi-modal data with mixtures of…
Read More
What are the motivation behind random forests and mention two reasons why they are better than individual decision trees?

What are the motivation behind random forests and mention two reasons why they are better than individual decision trees?

The motivation behind random forest or ensemble models in general in layman's terms, Let's say we have a question/problem to solve we bring 100 people and ask each of them the question/problem and record their solution. Next, we prepare a solution which is a combination/ a mixture of all the solutions provided by these 100 people. We will find that the aggregated solution will be close to the actual solution. This is known as the "Wisdom of the crowd" and this is the motivation behind Random Forests. We take weak learners (ML models) specifically, Decision Trees in the case of…
Read More
How to start programming? Step By Step Guide

How to start programming? Step By Step Guide

Programming is the key to getting success in a tech carrier, when I talk about programming I mean efficient programming. It means the coding which is time and space-efficient. How can we make programs which is time and space-efficient by learning data structure and Algorithms? So that’s why data structure and algorithms are so much required for preparing for interviews. Now there is a huge list of websites that are there for preparing these algorithms and these algorithms and data structures are mostly used during interviews as when we are working in Industry we mostly focus on API development and using the…
Read More
What are the good websites to learn data structures and algorithms?

What are the good websites to learn data structures and algorithms?

Well! Programming is fun once you get it and the great part is a decent developer gets an enormous check from Top Tech Giants Like (Google, Amazon, Walmart, Microsoft, Facebook, and Apple). Data Structure and algorithms are needed for breaking interviews in these first-rate organizations. Regardless of whether you are a fledgling or middle in Algorithm abilities for the most part learning complete data structure, required 2-3 months. Likewise, getting ready code without help from anyone else is the fundamental model for the arrangement cycle. The following are a few decent assets for learning Data structure and Algorithms: 1. Geeksforgeeks: Geeksforgeeks has an expanse of issues.…
Read More
Data Structure & Algorithms Interview Questions

Data Structure & Algorithms Interview Questions

In this post we will be providing some questions frequently asked in Interview. Comment their answers below Arrays How do you find the missing number in a given integer array of 1 to 100?How do you find the duplicate number on a given integer array?How do you find the largest and smallest number in an unsorted integer array?How do you find all pairs of an integer array whose sum is equal to a given number?How do you find duplicate numbers in an array if it contains multiple duplicates?How are duplicates removed from a given array in Java? Linked List How…
Read More
Search an element in a sorted and rotated array

Search an element in a sorted and rotated array

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time. Example:   Input : arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3}; key = 3 Output : Found at index 8 Input : arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3}; key = 30…
Read More
C Program to Insert an element in array

C Program to Insert an element in array

An array is a collection of items stored at contiguous memory locations. In this article, we will see how to insert an element in an array in C.Given an array arr of size n, this article tells how to insert an element x in this array arr at a specific position pos. For example we have to insert 100 at 3rd position. Algorithm Here’s how to do it.  First get the element to be inserted, say xThen get the position at which this element is to be inserted, say posThen shift the array elements from this position to one position forward, and do this for all the other elements next to…
Read More
What is the Backend Developer Roadmap

What is the Backend Developer Roadmap

A backend developer is responsible for building the structure of a software application HTTP The Hyper Text Transfer Protocol(HTTP) is the foundation of the World Wide Web, and is used to load web pages using the hypertext linksHTTP is an typical flow over HTTP which involves a client machine making a request to a server, which then sends a response message. REST RES stands for Representational State Transfer.It is a set of protocol/standards that describe how communication should take place between the computers and other applications across the network.Suppose a Web App wants to communicate to a Web Server, So a…
Read More
Feature engineering and SGDReg with Regularization With Students Performance Data

Feature engineering and SGDReg with Regularization With Students Performance Data

All Need Imports for the data import pandas as pd pd.options.display.max_colwidth = 80 import numpy as np import matplotlib.pyplot as plt %matplotlib inline from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.preprocessing import StandardScaler from sklearn.linear_model import SGDRegressor from sklearn.svm import SVC # SVM model with kernels from sklearn.model_selection import GridSearchCV from sklearn.model_selection import cross_val_score from sklearn.metrics import mean_squared_error import warnings warnings.filterwarnings('ignore') Loading and Exploring Data There are two files of students performance in two subjects: math and Portuguese (Portugal is the country the dataset is from). Important notice : description (later on, as DESCR) tells that "there are…
Read More