Skip to content

Instantly share code, notes, and snippets.

View gauravk268's full-sized avatar
🏠
Working from home

Gaurav Kumar gauravk268

🏠
Working from home
View GitHub Profile
@gauravk268
gauravk268 / Breaking_Bricks.cpp
Created January 4, 2020 14:38
January Challenge 2020 Division 2 Question 1
/*
link : https://www.codechef.com/JAN20B/problems/BRKBKS
For her next karate demonstration, Ada will break some bricks.
Ada stacked three bricks on top of each other. Initially, their widths (from top to bottom) are W1,W2,W3.
Ada's strength is S. Whenever she hits a stack of bricks, consider the largest k≥0 such that the sum of widths of the topmost k bricks does not exceed S; the topmost k
bricks break and are removed from the stack. Before each hit, Ada may also decide to reverse the current stack of bricks, with no cost.
Find the minimum number of hits Ada needs in order to break all bricks if she performs the reversals optimally. You are not required to minimise the number of reversals.
@gauravk268
gauravk268 / Multiply_two_polynomials.c
Last active December 30, 2019 17:55
Multiply Two Polynomials
/*
link: https://practice.geeksforgeeks.org/problems/multiply-two-polynomals/0
Given two polynomials represented by two arrays that contains the coefficients of poynomials, print the polynomial in form of array formed after multiplication of given polynomials.
Input:
The first line contains an integer T, depicting total number of test cases.
First line of each test case contains two integers M and N ,highest degree of the polynomial arr1 and arr2.Next two line contains M and N integers , decribes the coefficients of polynomials