Skip to content

Instantly share code, notes, and snippets.

View itirkaa's full-sized avatar
:octocat:
Focusing

Aakriti Sharma itirkaa

:octocat:
Focusing
View GitHub Profile
#include <iostream>
#include <stack>
bool isBalanced(std::string sequence) {
std::stack<char> stk;
for (int i = 0; i < sequence.size(); i++) {
if (sequence[i] == '[' || sequence[i] == '{' || sequence[i] == '(')
stk.push(sequence[i]);
else if (sequence[i] == ']' || sequence[i] == '}' || sequence[i] == ')') {
if (stk.empty()) return false;
// Author: Aakriti Sharma
// Date: 3rd August 2020
#include<iostream>
#include<string>
#include<algorithm>
// Funtion to compare if the number of digits are equal or not
// if not then add string of zeros in from of the smaller number
void addZeros(std::string* num1, std::string* num2) {
#include<iostream>
void printArray(int arr[], size_t size) {
// Function to print the array of size arr
for (int i = 0; i < size; i++) {
std::cout << arr[i] << std::endl;
}
}
int* insertElement(int arr[], size_t size, int ele, int index) { // Note: size is the size of argument arr[]