Open in app

Sign In

Write

Sign In

Pratik Tiwari
Pratik Tiwari

3 Followers

Home

About

Mar 23

Kadane’s Algo (cp-1)

Always good to start with simpler things first. Problem Statement: Problem is to find the maximum subarray sum possible of all the non-empty subarrays given integer array. Example: Input: [-37, -7, 5, 1, 2, -4, 7, -1] Output: 11 Subarray [5, 1, 2, -4, 7] is the max sum contiguous subarray with…

Kadanes Algorithm

2 min read

Kadanes Algorithm

2 min read


Jan 1, 2021

CSES Dynamic Programming (Knapsack Problems)

Q1. https://cses.fi/problemset/task/1633/ Variant of Coin Change Problem “For each i as target, count all possible ways using given coins” dp[i] = All possible ways to get i using all coins

Cses

2 min read

CSES Dynamic Programming (Knapsack Problems)
CSES Dynamic Programming (Knapsack Problems)
Cses

2 min read


Dec 31, 2020

Binary Search : Templates to Remember

Binary Search : Part 1 (LowerBound and UpperBound) Starting with basic template for lower bound and upper bound, Given an array and a target value, we are suppose to find value greater then equal to target (Lower Bound) and value greater then target (Upper Bound) Lower Bound (iterative , C++ function)

Binary Search

2 min read

Binary Search : Templates to Remember
Binary Search : Templates to Remember
Binary Search

2 min read


Dec 29, 2020

Practical Nginx: Installation

Step-1: Installation of Nginx on Host. (Debian)

Nginx

2 min read

Practical Nginx: Installation
Practical Nginx: Installation
Nginx

2 min read


Dec 28, 2020

Dynamic Programming Must Do Questions for FAANG

1. Reach Target (Minimum or Maximum Value/count) Statement: Given a target find minimum (maximum) cost / path / sum to reach the target. Approach: Choose minimum (maximum) path among all possible paths before the current state, then add value for the current state. routes[i] = min(routes[i-1], routes[i-2], ... , routes[i-k]) + cost[i] Generate optimal solutions for all…

Dynamic Programming

5 min read

Dynamic Programming

5 min read

Pratik Tiwari

Pratik Tiwari

3 Followers
Following
  • Jimmy Song

    Jimmy Song

  • Gusaidharmesh

    Gusaidharmesh

  • Tirth Pandit

    Tirth Pandit

See all (6)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech