Skip to content

Instantly share code, notes, and snippets.

View Zyro9922's full-sized avatar
🕷️
Boo!

Ali Hasan Zyro9922

🕷️
Boo!
  • Amazon
  • Bengaluru
  • 09:53 (UTC -12:00)
  • LinkedIn in/zyro9922
View GitHub Profile
/**
* Muhammad Ali, one of my great heroes, had a great line
* in the '70s when he was asked "How many sit-ups do you do?"
* He said, "I don't count my sit-ups. I only start counting when
* it starts hurting. When I feel pain, that's when I start counting
* because that's when it really counts". That's what makes you a
* champion. And that's the way it is with everything.
* ~ Arnold Schwarzenegger
**/
#include <bits/stdc++.h>
/**
* He said, "I don't count my sit-ups. I only start counting when
* it starts hurting. When I feel pain, that's when I start counting
* because that's when it really counts". That's what makes you a
* champion. And that's the way it is with everything.
* ~ Arnold Schwarzenegger
**/
#include <bits/stdc++.h>
#include <algorithm>
int Solution::perfectPeak(vector<int> &arr) {
int n = arr.size();
set<int> left;
left.insert(arr[0]);
map<int, int> right;
for (int i = 1; i <= n - 1; i++) {
++right[arr[i]];
}
for (int i = 1; i <= n - 2; i++) {
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
int peakElement(int arr[], int n)
{
int left = 0;
int right = n - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if ((mid == 0 && arr[mid + 1] <= arr[mid]) ||
(mid == n - 1 && arr[mid - 1] <= arr[mid]) ||
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int sumOfDigit(int n) {
int sum = 0;
while (n) {
sum += (n % 10);
n /= 10;
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
INPUT 1
4 3 3 3 2 s1 p1 4 p3 p4 p6 p7 p6 p10 p9 p1
OUTPUT 1
Enter total no. of sites:
Enter total no. of process in Site "s1"
Enter total no. of process in Site "s2"
Enter total no. of process in Site "s3"
Enter total no. of process in Site "s4"
No. of processes in Site :s1 are :p1 p2 p3
#include<bits/stdc++.h>
using namespace std;
set<string> result;
void _all_paths(vector<vector<int>> adjList, set<int>& visited, string path, int cur) {
if (visited.size() == adjList.size())
return;
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
string number;
void intToString(int n) {