# Monthly Archives: March 2017

## 0-1 Knapsack Problem / UVa 10130

It’s a well known greedy algorithm, if you are not known with this algo, You can go through a tutorial ,here is the link Click this If you are from ,then you should go to Shafaet vaiya’s blog , click … Continue reading

## A New Alphabet

Problem Link Create an array to store the characters &store them then take input if there is any uppercase ,change the character to lowercase then print the value View Code #include <bits/stdc++.h> using namespace std; int main() … Continue reading

Kattis Solutions ACM A New Alphabet

## ACM

Problem: HINT: create two array sizeof 30 (more than 26); store the penalty time in one of them and other is used as a visited array then for right verdict store the submission time & make it visited and if … Continue reading

## Stable Marriage

Stable Matching : Stable marriage simply works on preference like seeking a better opportunities of matching , Finding out best choice from many choice can be done with stable marriage ,the working algorithm is Gale Shapley Algorithm in youtube,there are … Continue reading

## 1009: Back to Underworld

Problem Link It is a bfs Problem Try Enough?View Code #include<bits/stdc++.h> #define N 20005 using namespace std; #define ll long long vectorg[N]; int color[N]; #define pb push_back #define bl 2 #define rd 1 #define nc 0 int bfs(int src) … Continue reading

## 1042 – Secret Origins

Problem Link We know a way to count next number of same number of 1 bit ll checkfor_same_count_ones(ll n) { ll co=0; while(n) { co+=n&1; n>>=1; // n/=2; } return co; But the verdict will TLE ,because timelimit is .5 … Continue reading