Skip to content

Instantly share code, notes, and snippets.

View swetarajbhar's full-sized avatar
🎯
Focusing

Sweta Rajbhar swetarajbhar

🎯
Focusing
  • Mumbai
View GitHub Profile
@swetarajbhar
swetarajbhar / balancedparanthesis.cpp
Created November 1, 2020 14:10
Check for balanced parentheses in an expression
#include<iostream>
#include<stack>
using namespace std;
bool checkbalance(string expr)
{
stack<char> s;
char x;
for(int i=0;i<expr.length();i++)
{
@swetarajbhar
swetarajbhar / choc.cpp
Created November 1, 2020 11:48
Chocolate and Wrapper Puzzle
#include<iostream>
using namespace std;
int totalchoc(int money,int price,int wrap)
{
if(money < price)
{
return 0;
}
int choc=money/price;
choc = choc+(choc-1)/(wrap-1);