uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
d1abb8fa-3370-4007-a3ae-6c1d662a0633
ishandutta2007/codeforces
ksun48/normal/853/A.cpp
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main(){ LL n, k; cin >> n >> k; LL c[n]; for(LL i = 0; i < n; i++){ cin >> c[i]; } set<pair<LL,LL> > st; for(LL i = 0; i < k; i++){ st.insert(make_pair(-c[i], i)); } map<LL,LL> best; for(LL i = k; i < k+n; i++){ if(i < n) st.insert...
ALGO
0.999996
3.05545
a2cda216-3bf5-4e2d-95bb-9dbb8da9e914
DamianArado/LeetCode-tracker
45-jump-game-ii/45-jump-game-ii.cpp
class Solution { public: int jump(vector<int>& nums) { int n = size(nums), curFarthest = 0, curEnd = 0, jumps = 0; for(int i = 0; i < n - 1; ++i) { curFarthest = max(curFarthest, i + nums[i]); // moving level-by-level if(i == curEnd) { ++jumps; ...
ALGO
0.999983
5.983907
8ea59338-abdc-4488-9822-a56a41f597be
OOProgram/Cpp
practice/week06/darlyee/Dept1.cpp
#include <iostream> #include "Dept1.h" using namespace std; Dept::Dept(int size) { this->size = size; scores = new int[size]; } Dept::~Dept() { if (scores) delete[] scores; } int Dept::getSize() { return size; } void Dept::read() { cout << size << "개 점수 입력>>"; for (int i = 0; i < size; i++) cin >> scores[...
TOOL
0.978017
3.41543
60e1f2c0-9b3f-4442-acc2-7513eea7a484
HaihuaLiu1113/work
iegad_framework/libiegad/iegad/sercurity/iegad_aes.cpp
#include "iegad_aes.h" #include "string.h" #include <ctime> AES_128::AES_128(unsigned char* key) { memcpy(Sbox, sBox, 256); memcpy(InvSbox, invsBox, 256); _key_expansion(key, w); } AES_128::~AES_128() { } const std::string AES_128::encrypt(const char* input) { unsigned char state[4][4]; std::string res = input...
ALGO
0.996333
4.330054
724badc5-d72b-461a-896b-03dfba2391cf
fish9903/Algorithm
Example/DFS_BFS_3/main.cpp
#include <iostream> #include <vector> #include <queue> #include <algorithm> using namespace std; int N, K; int S, X, Y; // R, D, L ,U int moveX[4] = { 0, 1, 0, -1 }; // dx int moveY[4] = { 1, 0, -1, 0 }; // dy class Virus { public: int number; int x; int y; int t; Virus(int n, int i, int j, int s) :number(n),...
ALGO
0.999704
4.345371
80c40356-a3eb-4a3b-b15a-2f6f65f92888
Wally4Ever/Programare_C_1
Valentin.P_L11_05.cpp
//Valentin Ples, 2012 //valoarea medie a celor N elemente şi calculaţi Mn=(sum(pow((xi-xmed),n))/N #include <iostream> #include <math.h> #include <cstdlib> #include <time.h> using namespace std; void read(int); void afis(int); float sum(float*, int); float* deviatie(int); float *p; int main() { int n, i, w...
ALGO
0.999649
3.787199
594dea05-a15d-4933-9312-b2de31e5ea47
tuhin-cse/ProblemSolvingPractice
Summing the N series/main.cpp
#include <bits/stdc++.h> using namespace std; void solve(long long n) { long long mod=pow(10,9)+7; n%=mod; cout << (n*n)%mod << endl; } int main() { long long t,n; cin >> t; while(t--) { cin >> n ; solve(n); } }
ALGO
0.999712
5.137374
eaa4db88-0193-4111-9c57-011cddd85cd2
igobronidze/Algorithms200224
codeforces/contest_918_div4/problemD.cpp
#include <iostream> #include <string> using namespace std; int main() { int t; cin >> t; for (int p = 0; p < t; p++) { int n; cin >> n; string s; cin >> s; int i = 0; while (i < n) { if (i + 2 == n) { cout << s[i] << s[i + 1]; break; } if (i + 3 == n) { cout << s[i] << s[i + 1] <...
ALGO
0.998667
3.373738
41e7afb7-0df6-4b49-bdac-53afd8b7ca8c
kpurva1509/Modern-C-Design-Patterns
Interpreter Design Pattern/main.cpp
#include <iostream> #include <string> #include <vector> #include <map> #include <numeric> #include <fstream> #include <cstdio> #include <sstream> #include <memory> #include <numeric> #include <algorithm> #include <functional> #include <typeinfo> #include <memory> #include <boost/lexical_cast.hpp> #include <boost/spiri...
ALGO
0.994108
5.145562
10a3926f-2369-406d-af32-989c39002fc1
poke19962008/Competitive-Coding
gsCodeSprint/3.cpp
#include <algorithm> #include <iostream> #include <stdio.h> #include <math.h> #include <string> #include <vector> #include <stack> #include <queue> #include <list> #include <map> #include <set> using namespace std; #define EPS 1e-9 #define INF 1e15+9 #define MOD 1000000007 #define MAXN 1000006 #define ioS ios_base::s...
ALGO
0.999539
3.621564
96fd133e-5323-465a-b329-c721ab782261
rt-kill/CompetitiveProgramming
Codeforces/1794/E/main.cpp
#include <bits/stdc++.h> using namespace std; /* Macros {{{ */ /* Basics {{{ */ using ll = long long; using ull = unsigned long long; using ld = long double; using str = string; using pi = pair<int,int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; using vi = vector<int>; using vll = vec...
ALGO
0.998648
4.35362
e5e4296a-7673-4ddb-b898-fee19f35cbf7
rapidswap/algorithm-study
dfs,bfs/헌내기는 친구가 필요해.cpp
#include <iostream> #include <cstring> #include <queue> #include <tuple> #include <unordered_map> #include <climits> #include <set> using namespace std; char campus[601][601]; bool vist[601][601]; int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; int N, M; int main() { ios::sync_with_stdio(0); cin.tie(0); ...
ALGO
0.999964
4.286056
b33bb3af-f08b-443b-aa47-78489c045026
OanceaLucian/Lab-pa-2014
dfs/C++/p2.cpp
/** * Proiectarea Algoritmilor, 2013 * Lab 7: Aplicatii DFS * * @author Radu Iacob * @email <EMAIL> */ #include "Graph.h" /* Afiseza elementele din componenta biconexa curenta */ void print_biconex_component( Graph& g, int nod1, int nod2 ) { std::cout << "Componenta biconexa (id-uri): "; std::set< int >...
ALGO
0.982265
5.268194
faa31735-ba88-4fa2-988e-c92da488054c
priyanka2061/DAS-with-Sandeep-Jain
Bit-Magic/kthbit.cpp
// check kth bit is set or not /* k=3 n=5 => 0000--------101 true if kth bit is set // answer logic is set all bit zero accept kth bit how can we do 00000----101 now left shift 1 with k-1 => 00000-----100 now perform and operator & */ #include<iostream> using namespace std; int main () { int n=5...
ALGO
0.99968
5.15308
0dcee8fc-5fdb-450c-94b0-16cb08756242
CollinErickson/CGGP
scratch/OldScratch/BackupBeforeBigChanges20190310/src/specialkronfunctions.cpp
#include <Rcpp.h> using namespace Rcpp; // This is a simple example of exporting a C++ function to R. You can // source this function into an R session using the Rcpp::sourceCpp // function (or via the Source button on the editor toolbar). Learn // more about Rcpp at: // // http://www.rcpp.org/ // http://adv-r.ha...
ALGO
0.9977
5.722886
f3ade9c7-0923-4893-89f1-9daa444194a4
Yarmoshch/image_processor
image_processor/filters/Blur.cpp
#include "Blur.h" void BlurDir(Image &image, float sigma, bool dir) { Image new_im(image.Width(), image.Height()); float m = 1.0f / (sigma * std::sqrt(2 * M_PI)); // NOLINT float n = expf(-1.0f / (2 * powf(sigma, 2))); // NOLINT for (int x = 0; x < image.Width(); ++x) { for (int y = 0; y < ...
ALGO
0.991903
6.123678
81e4c0d7-ccaf-4f2c-84a3-1b47c7ef6b9f
jkrahl/fi
tema-3a-elements-basics-de-c/3a.11.cpp
#include <iostream> using namespace std; int main() { float num1, num2, num3, mitjana; cin >> num1 >> num2 >> num3; mitjana = (num1 + num2 + num3) / 3.0; cout << "La mitjana de les tres notes " << num1 << ", " << num2 << " i " << num3 << " es " << mitjana; }
ALGO
0.997683
3.839893
b0218356-f68c-4363-9bb8-05a9b2ba2dce
Sourabhp295/Coding
2582-pass-the-pillow/2582-pass-the-pillow.cpp
class Solution { public: int passThePillow(int n, int time) { int count = 1; int x = 1; while (time>0){ if(x%2 != 0){ count++; } else{ count--; } if(count == n || count == n-(n-1)){ ...
ALGO
0.999993
6.082683
bd449380-ec8b-4530-95c7-93c43d0a1ca8
TURX/Algorithm-CodeLib
Luogu/P2945.cpp
#include <iostream> #include <algorithm> using namespace std; const int MAXN = 25000; int N, X, Y; long long M[MAXN], B[MAXN], tot = 0; int main() { ios::sync_with_stdio(false); cin >> N >> X >> Y; for (int t = 0; t < N; t++) { cin >> M[t] >> B[t]; } sort(M, M + N); sort(B, B + N); ...
ALGO
0.999955
3.530049
9669c1c4-e87c-4f32-a02a-5663932b0939
sidcrz/leetcodeandgfgsolution
50-powx-n/50-powx-n.cpp
class Solution { public: double myPow(double x, int n) { return pow(x,n); } };
ALGO
0.999457
5.40283
5293fddc-3ffe-43f4-a1c0-c30796a56696
zezehz/test
opencv-3.4.1/modules/features2d/src/keypoint.cpp
#include "precomp.hpp" namespace cv { struct KeypointResponseGreaterThanThreshold { KeypointResponseGreaterThanThreshold(float _value) : value(_value) { } inline bool operator()(const KeyPoint& kpt) const { return kpt.response >= value; } float value; }; struct KeypointRespons...
TOOL
0.958874
6.086162
6606c5ee-0e7a-4d55-b9dd-979b2090f331
MHF2145/Data-Structure-2023
Other Class/Strukdat Kelas G/Strukdur_Data/Praktikum/nyoba/buat_modul_3/MTS.cpp
#include <stdlib.h> #include <stdbool.h> #include <stdio.h> #define max(a,b) (a > b)? a : b typedef struct AVLNode_t { int data; struct AVLNode_t *left,*right; int height; }AVLNode; typedef struct AVL_t { AVLNode *root; unsigned int size; }AVL; AVLNode* createNode(int value) { AVLNode *newNod...
ALGO
0.999914
3.939891
ee95c413-1d8e-483e-a0a1-58824f8641ae
raaihank/problem-solving
cpbook_subeen_problems/সমস্যা - ৭১ ( যোগ্য সংখ্যা ২ ).cpp
#include <iostream> #include <cstdio> #include <cmath> using namespace std; int main() { int T; cin >> T; int num,ck, pNum[5] = {6, 28, 496, 8128, 33550336}; while(T--){ cin >> num; for(int i=0; i<5; i++){ if( pNum[i] <= num ){ cout << pNum[i] << endl; ...
ALGO
0.997971
3.606294
2a744046-d638-41f6-a2e3-687091906079
martimdfneves/ECT
2 ano/2 semestre/AlgC/aula4/aula4_1.cpp
#include <stdio.h> #include <stdlib.h> /* aluso da funo que implementa o algoritmo pretendido */ /* allusion to the function that implements the algorithm */ int VerifyDifferences (int [], int); /* varivel global para contar as operaes aritmticas executadas pelo algoritmo */ /* global variable for counting the arithm...
ALGO
0.987518
4.459896
ff84c113-e865-4eeb-a1ca-ae8aa2f7c123
Aast12/competitive-programming
kattis/snapperhard.cpp
#include <iostream> using namespace std; int main() { int T, n, k; cin >> T; for (int t = 1; t <= T; t++) { cin >> n >> k; int base = 1 << n; cout << "Case #" << t << ": "; if (k % base == base - 1) { cout << "ON\n"; } else { cout << "OFF\...
ALGO
0.999516
5.267227
2a526cd9-765e-4eeb-9bcf-ce11a758b7af
MahbubAhmedTonmoy/algorithm_DS_code
graph/BFS/BFS.cpp
/* 1 -- apply only unicost graph 2 -- need 2 array visit[] , cost[] 3 -- use queue step: 1 : push source node 2 : check queue is empty/not 3 : if not empty -> pop queue front -> visit adjacency node + push in queue 4 : update cost */ /** 1\ | \ | \ 2 3 | \ | | \ | | 4 | | /\ | | / \ | 5 / ...
ALGO
0.999974
4.563791
df924c16-eb5f-43ff-8ae5-143a15930902
OmarZOS/star-crafter
MulMatrixQueue/Header.cpp
#include "Header.h" OMatrix::OMatrix(int a,int b){ M=new Unit*[a]; for(int i=0;i<b;i++) M[i]=new Unit[b]; n=a; m=b; } ostream& operator << (ostream& out,const OMatrix &a) { for(int i=0;i<a.n;i++) { for(int j=0;j<a.m;j++) out<<a.M[i][j].x<<" "; out<<endl; } return out; } istream& operator >> (istream& ...
ALGO
0.997394
3.387856
ea0a2313-9f2e-43cf-8147-1b4f004e6c6b
salonirai1807/DSA
Patterns/p7.cpp
#include<iostream> using namespace std; /* Pattern #17 A B C C D E D E F G */ int main() { int i1, j1, n1; cout<<"Enter No. of Rows & Columns : "; cin>>n1; i1=1; while(i1<=n1) { char start = 'A' + i1 - 1; j1=1; while (j1<=i1) { cout<<start<<" "; ...
ALGO
0.996741
3.375072
1476f224-0420-4036-9005-c63e5a0d1b37
austinsonger/Coding-Challenges
LeetCode/Algorithms/C++/maximum-gap.cpp
// Time: O(n) // Space: O(n) class Solution { public: struct Bucket { int max = numeric_limits<int>::min(); int min = numeric_limits<int>::max(); }; int maximumGap(vector<int>& nums) { if (nums.size() < 2) { return 0; } // Init bucket. int max_...
ALGO
0.999989
5.804381
cdb6c6fc-e17f-4561-9679-025de7ce1928
anuan520/SlopeCraft
SlopeCraftL/AiCvterOpt.cpp
#include "AiCvterOpt.h" using namespace SlopeCraft; AiCvterOpt::AiCvterOpt() { popSize=50; maxGeneration=200; maxFailTimes=50; crossoverProb=0.8; mutationProb=0.01; }
TOOL
0.886053
3.843404
d68b3c33-5d96-46da-9781-b9431d239c06
Zeratuli/Algorithm-Competition-Code-Set
训练题/牛客/牛客竞赛语法入门班选择结构习题/C默契.cpp
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e6+100; const int mod = 1e9+7; void solve(){ int x,y; cin >> x >> y; (x == y)?cout << "Tacit!" << endl :cout << "No Tacit!" << endl; return ; } signed main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; t = 1; ...
ALGO
0.999733
4.310469
7b83a869-a4f8-498a-9c32-c4a0f8d8885e
S-K-Siva/leetcode_problem-solving
2406_potd.cpp
class Solution { public: int minGroups(vector<vector<int>>& intervals) { priority_queue<int,vector<int> , greater<int>> pq; sort(intervals.begin(),intervals.end()); for(auto it : intervals){ if(!pq.empty() && pq.top() < it[0]){ pq.pop(); } ...
ALGO
0.999985
5.845366
68a81163-d332-4902-a5da-a1469da63aed
SetsunaChyan/OI_source_code
CF1204C.cpp
#include <bits/stdc++.h> using namespace std; int mp[105][105],n,m,now,a[1000005],des,dp[105][105][105]; vector<int> ans; void solve(int l,int r) { if(l==r) { ans.push_back(a[l]); return; } des=a[r]; now=a[l]; if(des==now) { ans.push_back(now); solve(l+1,r-1...
ALGO
0.999986
3.002376
84ae081d-2c6d-4317-baf3-2467e0885cf8
shubhangini22/Datastructures-and-algorithms
strings/recursively reverse.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution{ public: string removeConsecutiveCharacter(string S) { stack<char> st; st.push(S[0]); for(int i=0;i<S.length();i++) { char a=st.top(); if(...
ALGO
0.999949
6.665753
54fbde06-b668-4e78-820f-fe1997396072
akanazawa/si-convnet
src/caffe/layers/pooling_layer.cpp
#include <algorithm> #include <cfloat> #include <vector> #include "caffe/common.hpp" #include "caffe/layer.hpp" #include "caffe/syncedmem.hpp" #include "caffe/util/math_functions.hpp" #include "caffe/vision_layers.hpp" namespace caffe { using std::min; using std::max; template <typename Dtype> void PoolingLayer<Dty...
TOOL
0.908031
7.864795
909733e7-32c8-4939-a564-a3660742de8c
Yoshihiro4218/Algorithm
Beakjoon/2161/2161/main.cpp
#include <iostream> #include <vector> using namespace std; int main(int argc, const char * argv[]) { int tCase; vector<int> v,ans; cin>>tCase; for(int i=0;i<tCase;i++){ v.emplace_back(i+1); } while(v.size()!=1){ ans.emplace_back(*v.begin()); v.erase(v.begin()); ...
ALGO
0.999883
3.646249
50cd7747-e4cb-4e23-89f3-c85058020a42
pratiksha23-github/DAA
knasack_DP.cpp
/* A Naive recursive implementation of 0-1 Knapsack problem */ #include <bits/stdc++.h> using namespace std; int max(int a, int b) { return (a > b) ? a : b; } int knapSack(int W, int wt[], int val[], int n) { if (n == 0 || W == 0) return 0; if (wt[n - 1] > W) return knapSack(W, wt, val, n - ...
ALGO
0.999983
5.138572
e3b31168-8f17-4b76-a3ab-7c62cda63b1d
SumnRanjan/CPP-Code
10ArrayLevel-2/2PairSumArray.cpp
#include <iostream> using namespace std; int main() { int arr[] = {10, 20, 30}; int n = 3; int sum = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { //cout << arr[i] << "," << arr[j] << endl; sum = arr[i]+arr[j]; cout<<sum <<endl;;...
ALGO
0.998965
3.558997
d7dcf985-3b2f-401f-8b87-fd2fc93b3e99
fishjohn/legged_rl
legged_rl_controllers/src/BipedVisionController.cpp
// // Created by luohx on 23-11-17. // #include <ocs2_robotic_tools/common/RotationTransforms.h> #include <sensor_msgs/Image.h> #include <opencv2/imgproc.hpp> #include "legged_rl_controllers/BipedVisionController.h" #include <pluginlib/class_list_macros.hpp> namespace legged { void BipedVisionController::update(con...
ALGO
0.985583
7.053378
b4d33897-f991-4824-91ff-832db74d9b2b
ishandutta2007/codeforces
rfpermen/normal/1113/B.cpp
#include <bits/stdc++.h> #pragma GCC optimize("O2") using namespace std; #define ll long long #define ull unsigned long long #define rep(i,n,N) for(int i=n;i<=N;i++) #define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--) #define mp make_pair #define pb push_back #define pob pop_back #define pf push_front #define pof pop_f...
ALGO
0.999949
3.682616
338e5216-4d44-4fb1-8a72-b80285255946
Nath-Sant/Fatec
1°Semestre/Algoritmo/C++/C_09/Exercicio9.cpp
#include <stdio.h> int main(void){ float salario; printf("Digite o seu salario: "); scanf("%f", &salario); if(salario <= 1,903.98){ printf("Voce esta isento do imposto de renda"); }else if(salario > 1,903.98 && salario <= 2,826.65){ printf("O seu imposto de renda sera 7,5% do seu salario"); }else if(salari...
TOOL
0.978454
3.44282
1a6ca1e1-3fc6-40ed-922b-199eeb2d4f60
sivac88/GeeksForGeeks
Recursion/printAllValidParanthesis.cpp
// C program to Print all combinations // of balanced parentheses # include<stdio.h> #include <bits/stdc++.h> # define MAX_SIZE 100 using namespace std; void printParenthesis(char* str,int n,int open,int close,int i) { if(i==(2*n)) { str[i]='\0'; cout<<str<<endl; return; } if(o...
ALGO
0.997881
4.624288
00857b4b-88dc-463b-9939-c7d81f9082ce
WRivas19/CG22
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998733
6.76775
237091d8-c98a-4443-8ac6-88b2a31c9da0
Lewuathe/mlir-hello
thirdparty/llvm-project/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
// <algorithm> // template<ForwardIterator Iter, class T, class Compare> // constexpr Iter // constexpr after c++17 // lower_bound(Iter first, Iter last, const T& value, Compare comp); #include <algorithm> #include <functional> #include <vector> #include <cassert> #include <cstddef> #include "test_macros.h" #...
TEST
0.997149
6.993325
21d32fe2-cc8f-48a0-9d0f-0650888606f1
shahareng/CPP--WARGAME-B
FootSoldier.cpp
#include <iostream> #include <vector> #include "FootSoldier.hpp" using namespace std; void FootSoldier::attack(vector<vector<Soldier*>> &b, pair<int,int> location) { int x = location.first; int y = location.second; double min = 0; double dis = 0; Soldier* s; Soldier* enemy; Soldier* me = b...
ALGO
0.995733
3.263014
b07b99c2-bceb-43b8-a6f6-4cd841a14c2b
Parth-Thakar/Practice-Questions-C-
factorial.cpp
#include<iostream> using namespace std; int fact(int x) { int temp = 1; for(int i = x;i>0;i--) { temp = temp*i; } return temp; } int main() { cout<<fact(3); }
ALGO
0.999948
4.053853
8119e42e-f10e-48b7-8138-59e12aecfbfd
23f2002007/leetcode
solution/0200-0299/0254.Factor Combinations/Solution.cpp
class Solution { public: vector<vector<int>> getFactors(int n) { vector<int> t; vector<vector<int>> ans; function<void(int, int)> dfs = [&](int n, int i) { if (t.size()) { vector<int> cp = t; cp.emplace_back(n); ans.emplace_back(cp)...
ALGO
0.999922
5.863475
81d3c5df-32e2-4ca3-81b0-4b6095ae8cf3
mmatrosov/FKN2020
preliminary/G/33921386.cpp
#include <unordered_map> #include <algorithm> #include <iostream> #include <fstream> #include <iomanip> #include <cstring> #include <vector> #include <bitset> #include <queue> #include <deque> #include <ctime> #include <cmath> #include <stack> #include <set> #include <map> using namespace std; /*/#pragma comment(link...
ALGO
0.999986
3.938304
eca7ee57-110b-4f6e-bfaa-5eb971258581
boonto/raytracer
src/Raytracer.cpp
// // Created by Patrick Werner on 08.05.17. // #include "Raytracer.h" unsigned long long Raytracer::render(Window &window) { std::cout << "Scene with " << scene->primitives.size() << " primitives and " << scene->lights.size() << " lights"; auto resolution = scene->camera.getResolution(); counter = 0; ...
ALGO
0.946269
5.385315
76285f17-47eb-4209-b3a4-aa15ba71c27b
PrashantBhati001/Data-Structures-and-Algorithms
Array/Easy/Find_the_transition_point.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution{ public: int transitionPoint(int arr[], int n) { int s=0; int e=n-1; int mid=s+(e-s)/2; int ans=-1; while(s<=e) { if(arr[mid]...
ALGO
0.999877
6.259619
a971222c-fc7a-4315-b94d-2406bfac06e4
AdityaNarayan05/Leetcode-Solved-Questions
1962-remove-stones-to-minimize-the-total/1962-remove-stones-to-minimize-the-total.cpp
class Solution { public: int minStoneSum(vector<int>& piles, int k) { priority_queue<int> pq(piles.begin(), piles.end()); int res = accumulate(piles.begin(), piles.end(), 0); // cout<<res; while (k--) { int a = pq.top(); pq.pop(); pq.push(a - a / 2...
ALGO
0.999832
5.019195
1cf9d281-61bf-40dd-9472-be509ce9b3f4
OpenCAXPlus/OpenCAXPlus
OpenDigitalTwin-main/tools/gmsh/contrib/ANN/src/perf.cpp
#include <ANN/ANN.h> // basic ANN includes #include <ANN/ANNperf.h> // performance includes using namespace std; // make std:: available //---------------------------------------------------------------------- // Performance statistics // The following data and routines are used for computing // performa...
ALGO
0.957387
5.685638
b41bff98-094a-4789-bf49-263edd2e0ddf
Rajkumar992199/C-Plus-Plus
Leetcode/Easy/35_Search_Insert_Position.cpp
class Solution { public: int searchInsert(vector<int>& nums, int target) { if(nums.size() == 0) return 0; int n = nums.size(), l = 0, r = n - 1; while(l < r){ int m = l + (r - l) / 2; if(nums[m] == target) return m; else if(...
ALGO
0.999969
6.365608
4ce7f497-9b92-47ec-b8d2-69a24845b283
Andyvince01/UNISA2023-24.Artificial_Vision
YOLOX/demo/OpenVINO/cpp/yolox_openvino.cpp
#include <iterator> #include <memory> #include <string> #include <vector> #include <opencv2/opencv.hpp> #include <iostream> #include <inference_engine.hpp> using namespace InferenceEngine; /** * @brief Define names based depends on Unicode path support */ #define tcout std::cout #define file_name_t...
DATA
0.911827
6.155984
5b5f6b67-72ee-44f1-83d5-b0fa7e4fd5ca
shivam2207/HackerEarth-solutions
fooandexam.cpp
#include <iostream> #include <algorithm> #include <cmath> using namespace std; long long int funct(int ); int a,b,c,d; long long int k; int main() { int t; cin >> t; while(t--) { //int a,b,c,d,k; long long int sol; cin >> a >> b >> c >> d >> k; int t=1; while(1) { sol=funct(t); if(sol>k) { ...
ALGO
0.99988
3.441262
ed407679-a109-4476-b307-fee385435dd7
DeepakTLavate/deephpcdl
hpc1bfs_dfs.cpp
#include<bits/stdc++.h> using namespace std; struct TreeNode{ int val; TreeNode *left; TreeNode* right; TreeNode(int x): val(x),left(NULL),right(NULL) {} }; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); while(!q.empty()) { TreeNode* node=q.front(); q.pop(...
ALGO
0.999898
4.676259
bda7d3af-47cd-4c6e-817b-2d015c1d70a1
ashmit2c1/Graphs
g-minimum_spanning_tree/build_road.cpp
#include<bits/stdc++.h> using namespace std; int buildRoads(vector<vector<int>>&Coordinates){ vector<vector<pair<int,int>>>adj(Coordinates.size()); int n=Coordinates.size(); for(int i = 0; i<n ; i++){ int originalX = Coordinates[i][0]; int originalY = Coordinates[i][1]; vector<pair<...
ALGO
0.999972
4.441401
39b8b5c5-f270-430f-b2c0-1265e8102ae0
lingqing97/Leetcode_programming
No_0013.cpp
class Solution { public: int romanToInt(string s) { map<char,int> m; m.insert(pair<char,int>('a',0)); m.insert(pair<char,int>('I',1)); m.insert(pair<char,int>('V',5)); m.insert(pair<char,int>('X',10)); m.insert(pair<char,int>('L',50)); m.insert(pair<char,int>(...
ALGO
0.999765
5.579999
e109e494-d01e-4a95-b545-11e75d07a674
ishandutta2007/codeforces
emthrm/normal/1428/F.cpp
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int ...
ALGO
0.999986
4.800316
3d6f8f29-e9c8-4294-bd4d-558adca1ba87
Yawn-Sean/Daily_CF_Problems
daily_problems/2024/09/0921/personal_submission/cf1082b_Bonelight.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define endl '\n' #define pii pair<int, int> #define INF 2e14 void solve() { int n; cin >> n; string s; cin >> s; int G = 0; int ans = 0, lt = 0, now = 0, bil = 0; for(int i = 0; i < n; i ++){ if(s[i]...
ALGO
0.998909
4.220824
6f50728b-5671-4e92-8c11-d9e8c1a15074
ahan-ai/LeetCode
src/cpp/solution174.cpp
#include <vector> #include <iostream> using namespace std; class Solution { public: int calculateMinimumHP(vector<vector<int> >& dungeon); }; // Use dynamic programming, let min_remain[i][j] represents the minimum health // point when knight reaches dungeon[i][j]. And start calculate // min_remain[i][j] from th...
ALGO
0.999824
5.411029
e064682c-d4d3-42e2-9c8a-041ab66e64d0
gkumar9891/cpp-data-structures
sliding-window/minimum-window-substring.cpp
// https://leetcode.com/problems/minimum-window-substring/ #include <bits/stdc++.h> #include "../ctemplate.h" string minWindow(string s, string t) { unordered_map<char, int> mp; for(auto c : t) { mp[c]++; } int count = mp.size(); int i = 0; int j = 0; int start = 0; int end =...
ALGO
0.999985
6.188399
f684113c-48bc-4c21-ba08-e56de4b4bf36
hoshinon57/Algorithm
AtCoder/ABC301-400/ABC321-330/ABC321-F.cpp
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <set> using namespace std; typedef long long ll; const ll INF64 = 1LL << 60; const int INF32 = 0x3FFFFFFF; // =(2^30)-1 10^9より大きく、かつ2倍しても負にならない数 const ll MOD = 998244353; #define YesNo(T) cout << ((T) ? "Yes" : "No"...
ALGO
0.99973
4.765852
c0067120-c523-4de4-a347-52d4464605d4
nitin-sharma04/Leetcode-Solutions
0238-product-of-array-except-self/0238-product-of-array-except-self.cpp
class Solution { public: vector<int> productExceptSelf(vector<int>& nums) { int leftproduct = 1,rightproduct = 1; int n=nums.size(); vector<int> result(n,1); for (int i = 0; i < nums.size(); i++) { result[i]=leftproduct; leftproduct*=nums[i]; ...
ALGO
0.999968
6.27213
3c275339-8122-4145-812a-ead4032df2c9
AdityaNarayan05/Leetcode-Solved-Questions
0319-bulb-switcher/0319-bulb-switcher.cpp
class Solution { public: int bulbSwitch(int n) { int cnt=0; for(int i=1;i*i<=n;i++){ cnt++; } return cnt; } };
ALGO
0.999909
6.071349
7b89115a-a620-4598-945a-0ab8e32b0b0f
shivamkasaudhan/DailyDSA-2024
Week-13/ParityBinarySort.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int setbits(int n ){ int count =0; while(n>0){ int t = n%2; count+=t;; n/=2; } return count; } int main() { int t; cin>>t; while(t--){ int n ; cin>>n; int *a = new int[n]; for(int i=0;i<n;i++){ cin>>a[i]; } sort(...
ALGO
0.999091
4.068325
aec08e6e-574a-4503-b81b-44b79562f989
chrzhang/abc
digits/binary/adder/main.cpp
#include <iostream> #include <cstdlib> #include <ctime> #include <cassert> // Add numbers without arithmetic operators int add(int a, int b) { // Passed in as copies so modify as needed while (b > 0) { int carry = a & b; // Carries are caused when both bits are set a = a ^ b; // Addition without t...
TEST
0.988525
5.863621
434e6ae3-f620-4ef6-8d4d-183e34736094
TicoHsueh/PAT
Advanced Level/1128_N Queens Puzzle (20)【数组】.cpp
#include<iostream> #include<vector> using namespace std; int main(){ int n, m, i, j, flag; cin >> n; while(n--){ cin >> m; vector<int> queen(m); flag = 0; for(i = 0; i < m; i++){ cin >> queen[i]; if(flag) continue; for(j = 0; j < i; j++){ ...
ALGO
0.999966
4.384736
9cd30de7-4696-4263-bb7b-80365180188a
klotte/boost
src/boost_1_44_0/libs/graph/test/dfs_cc.cpp
#include <boost/concept_archetype.hpp> #include <boost/graph/depth_first_search.hpp> #include <boost/graph/graph_archetypes.hpp> int main() { using namespace boost; typedef default_constructible_archetype< sgi_assignable_archetype< equality_comparable_archetype<> > > vertex_t; { typedef incidence_gr...
ALGO
0.951654
5.270398
221ebf06-cd01-49bd-9989-cc2260873be4
coxlab/boost_patched_for_objcplusplus
libs/graph/example/default-constructor2.cpp
using namespace boost; template < typename Graph > void read_graph_file(std::istream & in, Graph & g) { typedef typename graph_traits < Graph >::vertex_descriptor Vertex; typedef typename graph_traits < Graph >::vertices_size_type size_type; size_type n_vertices; in >> n_vertices; // read in number...
ALGO
0.979119
5.71607
c1ebc2dc-424a-47b1-aad8-a332eb669c49
hoshinon57/Algorithm
AtCoder/ABC101-200/ABC161-170/ABC166-D.cpp
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> using namespace std; typedef long long ll; const ll INF64 = 1LL << 60; const int INF32 = 0x3FFFFFFF; // =(2^30)-1 10^9より大きく、かつ2倍しても負にならない数 template<class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } re...
ALGO
0.999944
4.005431
196c3921-a1d7-4a0b-bde3-cb3d730cd360
malvarado27/Amrex
Src/GeometryShop/AMReX_EBArith.cpp
#include "AMReX_EBArith.H" namespace amrex { /******/ void EBArith:: convertToITM(IndexTM<Real, SpaceDim>& a_diffrv, const RealVect& a_rv) { for(int idir = 0; idir < SpaceDim; idir++) { a_diffrv[idir] = a_rv[idir]; } } void EBArith:: convertToITM(IndexTM<int, SpaceDim>& a_diffrv, const IntVect& a_r...
ALGO
0.992231
3.936281
1f70a3fc-63d5-4c28-be46-b92b3b7b0b9d
ssk4988/Coding
UCFPT/230916/c.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pi = pair<int, int>; using pl = pair<ll, ll>; using pd = pair<ld, ld>; using vi = vector<int>; using vl = vector<ll>; using vd = vector<ld>; using vpi = vector<pi>; using vpl = vector<pl>; using vpd = vector<pd>; using vv...
ALGO
0.99994
4.556894
a97d623d-5401-4975-9e2f-fc276fd005ac
Huzaifa17/Hacker-Earth
Monk's_encounter_with_polynomial.cpp
#include<iostream> using namespace std; unsigned long long int bs(unsigned long long int a,unsigned long long int b,unsigned long long int c,unsigned long long int k) { long long int i,j,n,left=0,right=1000000001,mid; unsigned long long int sum,pos=1000000001; while(left<=right) { mid=(left+right)/2; sum=c+(mi...
ALGO
0.999872
3.515025
be56d2ce-c74c-47cc-a6d0-18ec456ebd60
KollenHub/VTKDemo
Chap05/5_5_01MeanFilterExample/main.cpp
#include <vtkImageCast.h> #include <vtkImageConvolve.h> #include <vtkImageShiftScale.h> #include <vtkSmartPointer.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkImageData.h> #include <vtkImageActor.h> #include <vtkRenderer.h> #include <vtkInteractorStyleImage.h> #include <vtkJPEGRea...
ALGO
0.866834
4.577955
60b5ec63-24dd-42a7-9df4-f8385646425e
virtyaluk/leetcode
problems/258/solution.cpp
class Solution { public: int addDigits(int num) { return num == 0 ? 0 : 1 + (num - 1) % 9; } };
ALGO
0.999788
6.459747
70b699b6-9b71-425e-a4f4-9ca879901a1d
bfrola/behavert
Samples/OpensteerDemo/src/Vec3.cpp
#include "OpenSteer/Vec3.h" // ---------------------------------------------------------------------------- // names for frequently used vector constants const OpenSteer::Vec3 OpenSteer::Vec3::zero (0, 0, 0); const OpenSteer::Vec3 OpenSteer::Vec3::up (0, 1, 0); const OpenSteer::Vec3 OpenSteer::Vec3::forward (...
TOOL
0.978316
6.715561
b38dba3d-3ed1-470a-874d-8b72a917fa36
chappi17/algorithm
algorithm/Bronze/11650.cpp
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; // 2 ǥ vector<pair<int,int>> v; . int main() { int N; cin >> N; int x = 0, y = 0; vector<pair<int, int>> cordinate; for (int i = 0; i < N; i++) { cin >> x >> y; cordinate.push_back({ x,y }); } sort(cordina...
ALGO
0.99992
4.46639
a22e4381-a8dc-46ad-a4c1-f84300f42710
tung2389/HSGS-Olympiad-code
Count.cpp
#include <bits/stdc++.h> using namespace std; #define x first #define y second pair<long long,long long> a[200000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; for(long long i=0;i<n;i++) { cin >> a[i].x >> a[i].y; a[i+n].x=a[i].x; a[i+n].y=a[i].y; } long lo...
ALGO
0.999849
4.271527
81af21a3-103a-418e-ae57-16b054c73ded
kasa021/atcoder-archives
abc079/abc079_d_36914501_AC.cpp
/* * Author: kAsA02 * Submission URL: https://atcoder.jp/contests/abc079/submissions/36914501 * Submitted at: 2022-12-01 12:35:05 * Problem URL: https://atcoder.jp/contests/abc079/tasks/abc079_d * Result: AC * Execution Time: 13 ms */ #include <bits/stdc++.h> #include <cmath> #if __has_include(<atcoder/all>) ...
ALGO
0.999513
4.036727
59f5c3d7-abe3-432d-bc8f-571bcd88723b
Meeperbunny/CompetitiveProgramming
archive/CF1016/_G.cpp
#include <bits/stdc++.h> using namespace std; #define HEADER ios::sync_with_stdio(0);cin.tie(0);if (fopen("file.in", "r")) {freopen("file.in", "r+", stdin);}; #define all(v) v.begin(), v.end() using ll = long long; void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T...
ALGO
0.99995
4.831629
024934cf-8be8-49be-8049-01d954ba0959
triod315/CPA
CPA/7/7.2.2.cpp
#include <iostream> #include <exception> #include <iterator> using namespace std; class MyException : public std::exception { private: char* mess; public: char* get_mess() { return mess; } MyException(char* message) { mess = message; } }; float square_area(float side) { ...
TOOL
0.933937
4.763282
18b32723-2c2f-4ee4-8a15-3c940b1c39b6
Fu188/SUSTech_Course
CS205_C-CPP/Lab Codes/Week12/Test2.cpp
#include <iostream> #include"Num.hpp" using namespace std; int main() { Number n1(20); Number n2 = n1++; cout<<n1<<endl; cout<<n2<<endl; Number n3 = n2--; cout<<n2<<endl; cout<<n3<<endl; Number n4 = ++n3; cout<<n3<<endl; cout<<n4<<endl; Number n5 = --n4; cout<<n4<<endl; cout<<n5<<endl; return 0; }
ALGO
0.98146
3.558787
eaa3d5c5-160c-4046-9d92-0f6a6b591141
AbdEsana/Ik
igl/copyleft/cgal/minkowski_sum.cpp
#include "../../slice.h" #include "../../slice_mask.h" #include "../../LinSpaced.h" #include "../../unique_rows.h" #include "../../get_seconds.h" #include "../../edges.h" #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <cassert> #include <vector> #include <iostream> template < typename Derived...
ALGO
0.998187
6.478438
2342f0f6-c5ce-4b13-8f65-b35187e4369e
saviodc/Classes
CAMclass.cpp
#include <iostream> #include "E101.h" #include <string> #include "MOTclass.cpp" class camera { private: colours c; motor::MP2 motP2; public: bool changeP(){ int rcount = 0; for(int row = 200; row < 222;row++){ // check rows 200-222, middle of camera for(int col = 0; col < 320;col++){ int r = (int)get_pixel(row...
ALGO
0.997358
3.689167
48a703b8-facd-4792-8101-69e9f65be40e
Harsh971/GFG_LEETCODE_POTD
GFG POTD/July-2023/20-07-2023.cpp
class Solution { public: //Function to find the first non-repeating character in a string. char nonrepeatingCharacter(string S) { unordered_map<int, int> f; queue<char> q; for(auto i : S){ ++f[i]; if(f[i] == 1) q.push(...
ALGO
0.999714
4.472983
7d976827-03dd-4570-b1e9-27282d2c3501
dilrajs616/Data-Strucuture-Lab-practicals
circularQueueOperations.cpp
//practical number fifth //design develop and implement a menu driven program for the following operations on circular queue of characters //1. insert an element onto circular queue //2. delete an element from circular queue //3. demonstrate overflow and underflow situations on cirular queue //4. display the status of ...
ALGO
0.982192
5.19976
82e5d5d3-b635-4e27-bd94-0c4710607454
navneetk2001/CPP_Programs
Test Series/Amazon test Series/Data Structures and Algorithms/11. Binary Search Tree Questions/15. k-th smallest element in BST.cpp
https://practice.geeksforgeeks.org/problems/find-k-th-smallest-element-in-bst/1# //Solution Approach :- //O(K) Time Complexity && O(1) space complexity Solution class Solution { public: // Return the Kth smallest element in the given BST void solve( Node *root, int K, int &ans, int &count){ if(!root){ ...
ALGO
0.999996
6.287741
451102b3-210f-496b-9c17-d94723b17f39
SuperBigFive/Charming_XCPC
AtCoder/ABC/ABC274/E(补).cpp
#include <bits/stdc++.h> #define ll long long #define int ll using namespace std; const int maxn = 20; const int maxm = 2e6 + 5; int n, m; double x[maxn], y[maxn]; double dp[maxn][maxm]; void init () { for (int i = 0; i < maxn; ++i) fill (dp[i], dp[i] + maxm, LLONG_MAX); } bool bit (int s, int i) {return (s >> i)...
ALGO
0.999925
4.598942
81e37192-9234-4a7c-b88b-07fdc9b6a18d
emonansar/URI-Problem-Solution
1185.cpp
#include <bits/stdc++.h> using namespace std; int main() { float M[12][12],sum=0,avg=0,n=0,d=0; char c; cin>>c; for(int i=0;i<12;i++) { for(int j=0;j<12;j++) { cin>>M[i][j]; } } for(int i=0;i<11;i++) { d++; for(int j=0;j<=11-d;j++) ...
ALGO
0.99802
3.498848
a7644c90-4213-45e1-8c5b-8a6c69394c7b
savecode99/demo_thamkhao
085.cpp
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #define all(v) v.begin(),v.end() #define f(i,a,b) for(int i=a; i<=b; ++i) #define fn(i,a,b) for(int i=a; i>=b; --i) #define faster() ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); const int MOD=1e9+7; using ...
ALGO
0.999912
4.621836
69fde0ea-ffce-4977-a2ff-d768118fd76b
HowardWeng0602/2023aaib3
week18/week18-2.cpp
//week18-2.cpp class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { int M = matrix.size(), N = matrix[0].size(); int i = 0, j = 0; int di[4] = {0,1,0,-1}; int dj[4] = {1,0,-1,0}; int d = 0; vector<int> ans; while( ans.size() < M * N ...
ALGO
0.999997
5.908691
fbd76206-f437-4b65-a810-4a148715d384
chmodxChironex/school
CV09/VectorMath.cpp
/* TODO: Vytvořte funkci, která porovná dva vektory podle jejich velikosti. Jako výsledek bude vracet celočíselnou hodnotu +1 (pro |u| > |v|), 0 (pro |u| = |v|) nebo -1 (pro |u| < |v|). */ #include "VectorMath.h" vector3d operace(vector3d u, vector3d v, typOperace typ) { vector3d vysledek; switch (typ) { ...
ALGO
0.992922
5.039096
add4474d-742f-4c01-b9ec-4c837738ea25
NestZ/competitive-programming
CodeForces/624A.cpp
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); int d, l, v1, v2;cin >> d >> l >> v1 >> v2; int v = v1 + v2; l -= d; printf("%.15f", (double)l / v); }
ALGO
0.997822
3.492986
e5834e15-64ef-48a7-859c-dc592ab7159d
popook88/TopCoder
SRM144DIV1P300.cpp
/* Problem Statement Let's say you have a binary string such as the following: 011100011 One way to encrypt this string is to add to each digit the sum of its adjacent digits. For example, the above string would become: 123210122 In particular, if P is the original string, and Q is the encrypted string, then Q[i] ...
ALGO
0.999982
6.050929
158886d2-175e-4c35-91b9-4b32d2c6cdee
alexandraback/datacollection
solutions_5709773144064000_1/C++/sQu1rr/codejam.cpp
#include <iostream> #include <iomanip> int main() { int size; std::cin >> size; for(int i = 0; i < size; ++i) { double C, F, X; std::cin >> C >> F >> X; double time = 0.0; double step = 2.0; double timeC = C / step; double timeX = X / step; do { ...
ALGO
0.999666
3.917812
7db6000a-d383-444c-bdbc-d1dfe749a8da
Livesi5e/Fractals
Fractals/Fractal.cpp
#include "Fractal.h" Vec2 Fractal::computeNext(Vec2 current, Vec2 constant) { const float zr = current.x * current.x - current.y * current.y; const float zi = 2.0 * current.x * current.y; return Vec2(zr + constant.x, zi + constant.y); } float Fractal::mod2(Vec2 z) { return z.x * z.x + z.y * z.y; } int Fractal::...
ALGO
0.995058
5.175667
2a4a57a1-7587-4b2a-8dff-f0b596a9e02b
archit-dev/LeetCode-Solutions
1011-capacity-to-ship-packages-within-d-days/1011-capacity-to-ship-packages-within-d-days.cpp
class Solution { public: bool helper(vector<int>& weights,int days,int shipCapa){ int numDays = 1; //i : 0->n // weight[i] <= shipCapa --> load cargo into the ship shipCapa-=weight[i]; // weight[i] > shipCapa --> we cannot load cargo , numDays +=1 , shipCapa // days == numDays -> return true, retur...
ALGO
0.999998
5.622038
6b4dfabd-900c-4c82-a853-e2cb7ff8dcb7
Jnguyen347/jnguyen347repo
h06/h06.cpp
/** * @author Put your name here * @date Put the date here * @file h06.cpp */ #include <string> #include <cctype> using namespace std; string STUDENT = "WHO AM I"; // Add your Canvas login name // Add your function here /////////////// Optional Student Code ///////////////// #include <iostream> int run() { ...
ALGO
0.934627
4.852889
d0deb899-09d6-47a3-8ac8-a4bfc0ee3336
iamRishant/Leetcode
169-majority-element/majority-element.cpp
class Solution { public: int majorityElement(vector<int>& nums) { int winner=nums[0]; int count=1; for(int i=1;i<nums.size();i++){ if(count==0){ winner=nums[i]; count=1; continue; } if(nums[i]==winner) count+...
ALGO
0.999902
5.629925