uuid
stringlengths
36
36
repo_name
stringlengths
5
123
relative_path
stringlengths
5
4k
content
stringlengths
33
2.85M
category
stringclasses
6 values
algo_rel_score
float64
0.85
1
quality_score
float64
3
8.76
6e0853b4-8ce6-4655-b297-e1f268e855b7
AnshRehan04/oops
Pointers/arraysusingpointers/arraypointer.cpp
#include <iostream> using namespace std; int main(){ int arr[3]={1,2,3}; int *ptr=(*arr); cout<<*ptr; }
ALGO
0.994199
3.177814
4c46b0cd-6f37-4648-b85a-2ec0c0cd15cd
FelipeHanada/MaratonaDeProgramacao
cp-algorithms/Algebra/ExtendedEuclideanAlgorithm/PraticeProblems/CodeForces/100963(gym) (not solved)/J-OnceUponATime.cpp
#include <bits/stdc++.h> using namespace std; int ext_gcd(int a, int b, int &x, int &y) { x = 1; y = 0; int x1 = 0, y1 = 1; while (b != 0) { int q = a / b; tie(x, x1) = make_tuple(x1, x - q * x1); tie(y, y1) = make_tuple(y1, y - q * y1); tie(a, b) = make_tuple(b, a - q * b);...
ALGO
0.999695
3.91415
0ab00e44-7c68-404f-a024-fac6cda900ce
cookiewho/F20_HW
CST370/hw2_2.cpp
/* * Title: hw 2_2.cpp * Abstract: This program takes takes in two time * Author: David Gaeta * ID: 4311 * Date: 09/03/2020 */ #include <iostream> #include <string> #include <sstream> using namespace std; int main(){ string s1, s2, temp1 = "", temp2 = ""; cin >> s1; cin >> s2; int temp3, temp4, c...
ALGO
0.998942
4.758384
d6e9f0c5-7a04-45ff-8199-47984ded2172
BHOOMI12345/LINKED-LIST
doubly.cpp
#include <iostream> using namespace std; class Node{ public: int data; Node * prev; Node * next; Node(int d) { this->data = d; this->prev = NULL; this->next = NULL; } }; void print(Node* &head) { Node * temp = head; while (temp!=NULL) { cout<<t...
ALGO
0.999724
4.471767
342ba058-dd3f-446a-b8c6-ecad1004c3c3
bhanujggandhi/ds-algo-learn
tries/trie-implement-2.cpp
#include <bits/stdc++.h> using namespace std; struct Node { Node* chars[26] = {NULL}; bool flag = false; int countwords = 0; int countpref = 0; }; class Trie { private: Node* root; public: Trie() { root = new Node(); } void insert(string word) { Node* node = ro...
ALGO
0.999269
5.118909
056c330b-69fd-48f2-83a3-930bc8feeb19
PhuocVinhLee/online_system_exam_quiz_programming
online_exam_system_backend/temp/nv8htyyo.cpp
#include<stdio.h> int add(int x, int y) { return(x+y); } int main() { int a, b; scanf("%d%d", &a, &b); //function call add(a, b); printf("%d",add(a, b)); return 0; } //function definition
ALGO
0.99306
4.372581
996100bc-5ebc-48e0-ad5b-654ea424f18b
Notorious-little/Augmentation
barcode_in_zone.cpp
#include <cassert> #include <iostream> #include <opencv2/core/core.hpp> #include "opencv2/imgproc/imgproc.hpp" #include <opencv2/highgui/highgui.hpp> #include <cmath> #include "methods.h" #include "barcode_in_zone.h" #include "barcode.h" //scr 3:25 ! void compute_trace (const int x1, const int y1, cons...
ALGO
0.998447
4.18021
ec108a46-99a3-4b14-8e34-0f7b6e9cb8a8
Dhanush0369/CP_Practice
C_Count_xxx.cpp
#include <bits/stdc++.h> #define int long long using namespace std; #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define F first #define S second #define endl '\n' ...
ALGO
0.99997
4.417874
cc596f43-bf4e-49cd-a9fd-84c02d7ac281
YudiKojima/beecrowd
ddd.cpp
#include <iostream> using namespace std; int main(){ int ddd; cin>>ddd; if(ddd==61){ cout<<"Brasilia"<<endl; } else if(ddd==71){ cout<<"Salvador"<<endl; } else if(ddd==11){ cout<<"Sao Paulo"<<endl; } else if(ddd==21){ cout<<"Rio de Janeiro"<<endl; ...
ALGO
0.998546
4.897174
e48e4b40-ccf5-4412-8091-1d88f3041981
noochila/-DSA-
Difficulty: Easy/Roof Top/roof-top.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: // Function to find maximum number of consecutive steps // to gain an increase in altitude with each step. int maxStep(vector<int>& arr) { // Your code here int c...
ALGO
0.999834
6.125871
3c6f8742-ef7f-4d71-a83b-92bcf3cd14aa
soshubh/Data-Structure-Algorithm
Graphs/Learning/Question/Hard/329. Longest Increasing Path in a Matrix.cpp
// https://leetcode.com/problems/longest-increasing-path-in-a-matrix class Solution { public: int longestIncreasingPath(vector<vector<int>> &matrix) { int m = matrix.size(); int n = matrix[0].size(); int ans = 0; vector<vector<int>> memo(m, vector<int>(n)); for (int i =...
ALGO
0.999996
6.379873
6ef73e2b-611c-4fe9-8511-f6c27077586a
bng44270/n00b_code
cpp/PUNCT1.CPP
#include <cstring.h> #include <iostream.h> class number { private: string numberArray; public: void getNumber() { cin >> numberArray; } void putCommas() { int i; for (i = numberArray.length(); i > -1; i = i - 3) { if (i == numberArray.length()) ...
TOOL
0.855268
5.131969
ab329660-725a-4489-9897-1a36f792f05a
ishandutta2007/codeforces
zihouzhong/normal/1567/D.cpp
#include <bits/stdc++.h> using namespace std; int T, s, n; long long a[11], x[110]; int main() { scanf("%d", &T); for (int i = a[0] = 1; i <= 10; i++) { a[i] = 11 * a[i - 1]; } while (T--) { scanf("%d %d", &s, &n); memset(x, 0, sizeof(x)); long long ans = 0; int...
ALGO
0.998204
3.603764
4ae30359-8da9-40de-96a7-d112d6d40376
hareeshghk/leetcode_solutions
867-transpose-matrix/867-transpose-matrix.cpp
class Solution { public: vector<vector<int>> transpose(vector<vector<int>>& matrix) { int m = matrix.size(); int n = matrix[0].size(); vector<vector<int>> result(n, vector<int>(m, 0)); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { result[j][i...
ALGO
0.999969
6.608444
bb5cc755-a4ad-4d63-8843-3cef8ce994ba
llynv/CP-files
codeforce/ftc_a_01.cpp
/* Code by: linvg Created: 20.10.2024 11:21:05 */ #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) string to_upper(string a) { for (int i = 0;i < (int)a.size();++i) if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A'; return a...
ALGO
0.999905
4.591362
c1c87302-aa3b-4112-82d5-ba8e3a155f65
Cautionarytale/algorithm_problems
data_structure/segment_tree/p3372.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e5+10; int n,m,p,input[maxn]; struct node{ int left,right; ll sum,mlz,plz; }tree[maxn<<2]; void build(int idx,int l,int r){ tree[idx].left=l;tree[idx].right=r;tree[idx].mlz=1; if(l==r){ tree[idx].sum=input[l]; return; } int mid...
ALGO
0.999878
4.14014
4307ae81-5422-4bb3-b044-7e8de3eb5e42
sabbir1054/CPP-programming
AllPractice/practiceMod3.5/prob01.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int x, t; cin >> x >> t; if (x>t) { cout << x - t; }else{ cout << 0; } return 0; }
ALGO
0.999894
3.698195
f0b5a3db-6d24-4abd-b771-c4edb88ce3b7
Rutetid/100DaysOfCode
How_much_scholarship.cpp
#include <iostream> using namespace std; int main() { int r; cin>>r; if(r<51) cout<<"100"; else if (r>50 && r<101) cout<<"50"; else cout<<"0"; return 0; }
ALGO
0.999368
3.199928
281f4fc6-fd09-4007-8984-44b412dc1a78
Inori/GPCS4
GPCS4/Graphics/Gcn/ControlFlowGraph/GcnLoopInfo.cpp
#include "GcnLoopInfo.h" LOG_CHANNEL(Graphic.Gcn.GcnLoopInfo); // A workaround for boost bug. // See https://github.com/boostorg/graph/issues/182 namespace boost { template <typename G> inline void renumber_vertex_indices(G& g) { throw; } } // namespace boost namespace sce::gcn { GcnLoop::GcnLoop() { } GcnL...
ALGO
0.912669
6.320588
f8d08572-b944-4284-a05d-059d2e9565f1
shradhahalle/programs
Program186.cpp
#include<iostream> using namespace std; class Marvellous { public: int Addition(int x , int y) { int iAns = 0; iAns = x + y; return iAns; } }; int main() { int iNo1 = 0, iNo2 = 0, iRet = 0; Marvellous mobj; // Marvellous mobj = new Marvellous(); cout<<"Enter fir...
TOOL
0.914095
4.185625
571a446e-59e6-4a56-8668-3d953a1a1e33
leestorm4520/CodingPractice_Algorithm
Patterns/Sliding Window/sliding/sliding.cpp
#include<iostream> #include<vector> #include<algorithm> using namespace std; class SlidingWindow{ public: static vector<double> findAverage(int K, const vector<int> &arr){ vector<double> result(arr.size()-K+1); double windowSum=0.0; int windowStart=0; for(int windowEnd=0;windo...
ALGO
0.99992
5.30162
1ab59f58-d8f0-4fb2-a251-3b0c7c9704be
pamarvss17/P2P_Network
cp3v3.cpp
#include<bits/stdc++.h> #include<dirent.h> #include<sys/types.h> #include <sys/stat.h> #include <cstdio> #include <cstdlib> #include<filesystem> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <arpa/inet.h> #i...
TOOL
0.981691
3.252499
2ba5e64d-7947-43c2-a5a1-01d8a1945b52
raincross7/code-similarity
codes/train_code/problem463/problem463_334.cpp
#include <iostream> #include <string> int main() { std::string str; std::string key; std::getline(std::cin, str); std::getline(std::cin, key); str += str; bool iskey = false; if(str.find(key) != std::string::npos) iskey = true; if(iskey) { std::cout << "Yes" << std::endl; } else { std::...
ALGO
0.999948
5.54276
99979cf6-d318-4867-b8db-5fe2e6fd2b83
Anshu202122/Daily_Questions
Leetcode/2025/Mar/21_FindAllPossibleRecipesFromGivenSupplies.cpp
class Solution { public: vector<string> findAllRecipes(vector<string> &recipes, vector<vector<string>> &ingredients, vector<string> &supplies) { int n = recipes.size(); vector<string> result; unordered_set<string> st(begin(supplies), end(supplies)); vector<bool> cooked(n, false);...
ALGO
0.99966
5.755531
88d612fc-ff19-498e-b1f8-2203e03a8cdf
cocolord/Algorithm_Code
acwing/basic/acwing_878线性同余方程组.cpp
#include <iostream> using namespace std; typedef long long LL; int n; int exgcd(int a, int b, int &x, int &y) { if(!b){ x = 1,y = 0; return a; } int d = exgcd(b,a%b,y,x); y -= a/b * x; return d; } int main() { cin >> n; while (n -- ) { int a, b , m; ...
ALGO
0.999785
3.877554
a1d0aae9-440c-4357-b94a-20aa5ad21bea
cliqz-oss/browser-f
mozilla-release/gfx/2d/BezierUtils.cpp
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ #include "BezierUtils.h" #include "PathHelpers.h" namespace mozilla { namespace gfx { Point GetBezierPoint(const Bezier& aBezier, Float t) { Float s = 1.0f - t; return Point(aBezier.mPoints[...
ALGO
0.999227
7.477204
4a51ac0a-9cef-494c-b591-2ff2c7db0807
GinugaSaketh/Codes
codeforces/CF_DP/PoloThePenguinAndMatrix.cpp
#include<bits/stdc++.h> using namespace std; int a[105][105]; int b[10005]; int c[10005]; int main(){ int n,m,d; cin>>n>>m>>d; int i,j; for(i=0;i<1005;i++){ b[i]=0; } int mi=10005; for(i=0;i<n;i++){ for(j=0;j<m;j++){ cin>>a[i][j]; if(a[i][j]<mi){ mi=a[i][j]; } } } int flag=0; //c...
ALGO
0.999957
3.165159
7c3b1d33-18e1-4607-9ce9-cb684f9bbf9a
Fneger/BSD_MDVR_UGD
boost_1_77_0/libs/spirit/example/x3/roman.cpp
/////////////////////////////////////////////////////////////////////////////// // // A Roman Numerals Parser (demonstrating the symbol table). This is // discussed in the "Symbols" chapter in the Spirit User's Guide. // // [ JDG August 22, 2002 ] spirit1 // [ JDG March 13, 2007 ] spirit2 // [ JDG May 13, 2015 ] ...
TOOL
0.967455
7.699979
104b1a8f-199b-4f23-a006-0a2a31e8b2d4
RickTseng/Cpp_LeetCode
0070_Climbing_Stairs.cpp
#include<vector> #include<stdlib.h> #include<algorithm> #include<string> using namespace std; class Solution{ public: int climbStairs(int n) { /* int count = 0; vector<int> stair = {n/2,n/1}; for(int i =0;i<=stair[0];i++){ if(i==0){ count++; } ...
ALGO
0.999933
4.754525
07a9f516-8e3f-459c-a523-e898de7aa9c3
EunSeong-Seo/coding_test
codeup_c++/1084.cpp
#include <stdio.h> int main() { int r,g,b; int count=0; scanf("%d %d %d",&r,&g,&b); for(int i=0;i<r;i++) for (int j=0;j<g;j++) for (int k=0;k<b;k++) { printf("%d %d %d\n",i,j,k); count++; } printf("%d",count); }
ALGO
0.998886
3.187689
2a7d52ec-3d74-4895-bdf7-bfd622553245
jcazevedo/leetcode
src/0125-valid-palindrome.cpp
// 125. Valid Palindrome // https://leetcode.com/problems/valid-palindrome/ #include <string> using namespace std; class Solution { public: bool isPalindrome(string s) { int left = 0, right = s.size() - 1; while (left < right) { if (!isalnum(s[left])) left++; else if (!isalnum(s[right]...
ALGO
0.998244
6.95434
2f552a2f-ad3e-458e-aa7e-0444a6328e4a
anishakd4/ds
Randoms/PrintLevelOrderTraversalLineByLineSet12.cpp
#include<iostream> #include<queue> using namespace std; struct Node{ int data; struct Node *left, *right; }; struct Node* newNode(int data){ struct Node* new_node = (struct Node*)malloc(sizeof(struct Node)); new_node->data = data; new_node->left = new_node->right = NULL; return new_node; } v...
ALGO
0.999827
5.01143
33f3eaf4-2d7b-4764-954e-907bddd737f4
Floydwish/codewars-cpp
6kyu/42.Sum of prime-indexed elements.cpp
/* 42.Sum of prime-indexed elements Instructions In this Kata, you will be given an integer array and your task is to return the sum of elements occupying prime-numbered indices. The first element of the array is at index 0. Good luck! test: Describe(Sum_of_prime_indexed_elements) { It(Example_tests) { ...
ALGO
0.999542
5.09183
5286d95d-22f7-4869-9351-67fcae5c8859
faterazer/LeetCode
0239. Sliding Window Maximum/Solution.cpp
#include <deque> #include <vector> using namespace std; class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { deque<int> max_queue; for (int i = 0; i < k; ++i) { while (!max_queue.empty() && max_queue.back() < nums[i]) max_queue.pop_back()...
ALGO
0.999988
6.147213
0edd3f71-75d4-4881-9fc9-a03bec16d72b
ishandutta2007/codeforces
tute7627/normal/1660/A.cpp
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> using namespace std; #define endl '\n' #define lfs cout<<fixed<<setprecision(10) #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end()) #define spa << " " << #define fi first #...
ALGO
0.999612
3.552155
43979a08-e0ca-4917-a92d-76f05207f2d7
sanwushuosi/OJ-CODE
codeforces/609d.cpp
//#include<stdio.h> //#include<string.h> //#include <bits/stdc++.h> //using namespace std; #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=200000; int a[maxn+5],b[maxn+5]; int totd[maxn+5],totp[maxn+5]; int k,s; long long cal_min(int x){ long long ret=(...
ALGO
0.999731
3.108324
f905bd0d-49ea-4bed-a473-152e669ce2f9
ilyasemov/LAB1_TIMP_SEMOV
1.2/main.cpp
#include <iostream> #include <cctype> #include "modAlphaCipher.h" #include <locale> using namespace std; bool (const wstring& s) { for (auto c:s) if (!iswalpha(c) || !iswupper(c)) return false; return true; } int main(int argc, char **argv) { int klych=3; locale loc("ru_RU.UTF-8"); ...
TOOL
0.98593
3.130436
68be6c07-6876-4c46-8b7d-d6959088ad50
daniel-meilak/Advent-of-Code-2021
week_1/day_7/day_7.cpp
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cstdlib> #include<numeric> #include"utils.h" int triangle_distance(int n){ return n*(n+1)/2; } int main(){ // read input into vector of int. std::vector<int> input = input_to_int(read_input("input_7", {","})); // task is t...
ALGO
0.999866
4.7218
aab23b3d-49b9-44fc-b5ac-98140df15cc5
Sean0628/competitive_programming
atcoder/abc/abc326/b.cpp
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; #define rep(i, n) for (int i = 0; i < (n); ++i) #define loop(i, a, b) for (int i = (a); i < (b); ++i) #define out(arg) cout << (arg) << endl #define debug(x) cerr << #x << ": " << (x) << endl #define debugv(x) cerr << #x << ":...
ALGO
0.999849
5.432515
ce88578d-b80f-4b14-8768-83f451c98f4a
divij1608/Programming
Pattern/RectanglePattern.cpp
#include<iostream> using namespace std; int main() { cout<<"RECTANGLE PATTERN \n"; int a,b; cout<<"Enter number of rows: "; cin>>a; cout<<"Enter number of columns: "; cin>>b; for(int i=0;i<a;i++) { for(int j=0;j<b;j++) { cout<<"*"; } cout<<endl...
ALGO
0.881066
3.524268
efbc35b5-9e91-4d64-abbe-d09dda28855e
balckwilliam/tengine_opendla_note
opencv-4.5.4/samples/cpp/tutorial_code/snippets/imgproc_HoughLinesCircles.cpp
#include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> #include <math.h> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat img, gray; if( argc != 2 || !(img=imread(argv[1], 1)).data) return -1; cvtColor(img, gray, COLOR_BGR2GRAY); // smooth it, otherwise a l...
ALGO
0.931631
4.424689
b99a368d-aebf-44ba-b486-ee89499587c7
CIBC-Internal/boost
libs/graph/example/edge_coloring.cpp
#include <boost/config.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/edge_coloring.hpp> #include <boost/graph/properties.hpp> /* Sample output Colored using 5 colors a-d: 4 a-f: 0 b-c: 2 b-e: 3 b-g: 1 b-j: 0 c-d: 0 c-e: 1 d-f: 2 d-i: 1 e-g: 4 f...
ALGO
0.995691
6.263731
6239e6e2-3e13-4637-9190-b1b47f508b2d
MrCryptoBeast/BSTP
src/wallet/feebumper.cpp
#include <interfaces/chain.h> #include <policy/fees.h> #include <policy/policy.h> #include <util/moneystr.h> #include <util/rbf.h> #include <util/system.h> #include <util/translation.h> #include <wallet/coincontrol.h> #include <wallet/feebumper.h> #include <wallet/fees.h> #include <wallet/receive.h> #include <wallet/sp...
TOOL
0.984423
7.455104
a64bd966-2481-4d36-bcec-bcd3bafccf7c
KKyzm/leetcode
cpp/0101.symmetric-tree/solution.cpp
// Created by Yaniru at 2023/10/04 00:28 // leetgo: dev // https://leetcode.cn/problems/symmetric-tree/ #include "LC_IO.h" #include <bits/stdc++.h> using namespace std; // @lc code=begin class Solution { public: bool isSymmetric(TreeNode *root) { return isSame(root->left, root->right); } private: bool isSame(Tr...
ALGO
0.999923
6.5098
85752904-d03b-45cf-ac46-a16985cee880
Catalin-Ripanu/HW_CN2
Vitis-HLS_Project_Sources/7_segment/7_seg.cpp
#include "7_seg.h" #include <string.h> #include <iostream> typedef enum { dis1, dis2, dis3, dis4, dis5, dis6, dis7, dis8 }display_state_type; void seven_seg (bool refresh_signal,ap_uint<8> input, ap_uint<8> &seg_seven_data, ap_uint<4> &seg_seven_enable){ #pragma HLS PIPELINE #pragma HLS INTERFACE mode=ap_none port=i...
TOOL
0.97324
5.413955
de5b9e9d-bc40-4d8d-9903-498759bf1925
renbaoshuo/OI-codes
Codeforces/1675/D/D.cpp
#include <iostream> #include <vector> using std::cin; using std::cout; const char endl = '\n'; const int N = 2e5 + 5; int t, n, fa[N], root, ans_cnt; std::vector<int> g[N], ans[N]; void dfs(int u, int fa, int cnt) { if (g[u].size() == 1) { ans[cnt].push_back(u); return; } ans[cnt].push_...
ALGO
0.999735
5.328883
d9af6ccd-3de8-4384-96a7-681a773652c2
gw3g/spectral
examples/dileptons.cpp
#include "core.hh" #include "quad.hh" #include "map.hh" #include "timer.hh" #include <fstream> #include <string> double k0,k; double mu_q = 0.; bool CHEM_POT = false; double MOT1, MOT2, MOT3, MOT4, MOT5;// mu over T double tol = 1e-4; // absolute tolerance using namespace std; // files ofstream fout; ifstream fin; ...
ALGO
0.99484
3.813134
96e5e10f-3322-492c-845a-76b12be3b8a8
ishandutta2007/codeforces
tle/normal/1267/B.cpp
#include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <string> #include <bitset> #include <vector> #include <set> #include <map> #include <queue> #include <algorithm> #include <sstream> #include <stack> #include <iomanip> #include <assert.h> using na...
ALGO
0.999986
3.091045
b4c017ad-2429-49b6-a170-d47060f116b8
rogerboesch/FatManBoo
libs/Box2D/Collision/Shapes/b2EdgeShape.cpp
#include <Box2D/Collision/Shapes/b2EdgeShape.h> #include <new> using namespace std; void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) { m_vertex1 = v1; m_vertex2 = v2; m_hasVertex0 = false; m_hasVertex3 = false; } b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const { void* mem = allocator->All...
ALGO
0.975175
7.599598
4b5b3681-1fb8-46cd-bfad-93c34a32d9f2
ishandutta2007/codeforces
darkkcyan/normal/1238/E.cpp
#include <bits/stdc++.h> using namespace std; using namespace std::placeholders; #define llong long long #define xx first #define yy second #define len(x) ((int)x.size()) #define rep(i,n) for (int i = -1; ++ i < n; ) #define rep1(i,n) for (int i = 0; i ++ < n; ) #define all(x) x.begin(), x.end() // #define rand __ran...
ALGO
0.99995
3.844895
b4138fb8-6d9d-4e89-81aa-590e6b97cc91
engrkashem/algorithms_cpp
dynamic_programming/frog1_recursive.cpp
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; /* - state: stone(n) -> cost of reaching n-th stone from 1st stone. - recurrance: stone(n) = min( stone(n-1) + abs(h[n] - h[n-1]) stone(n-2) + abs(h[n] - h[n-2]) ...
ALGO
0.999987
4.392736
ce74587d-e7c6-410d-991d-f4febc3195ca
yxd97/HiSparse
xrt/includes/xcl2/xcl2.cpp
#include "xcl2.hpp" #include <limits.h> #include <sys/stat.h> #include <unistd.h> namespace xcl { std::vector<cl::Device> get_devices(const std::string &vendor_name) { size_t i; cl_int err; std::vector<cl::Platform> platforms; OCL_CHECK(err, err = cl::Platform::get(&platforms)); cl::Platform platfo...
TOOL
0.936503
4.364617
5c46630a-02be-4867-8f09-4ec3d5e8e3b7
ashishc534/Trees-Data-Structure
Find all possible binary trees with given Inorder Traversal.cpp
#include <bits/stdc++.h> using namespace std; struct node { int key; struct node *left, *right; }; struct node *newNode(int item) { struct node *temp = new node; temp->key = item; temp->left = temp->right = NULL; return temp; } void preorder(node *root) { if (root != NULL) { ...
ALGO
0.999995
5.491201
a6d9cbc7-49e7-4dad-8799-9d9119377595
catupper/AOJans
vol05/0587/tunnel.cpp
#include<iostream> #include<algorithm> #define max(a, b) (a>b?a:b) using namespace std; int main(){ int n, m, a, b; cin >> n >> m; int res = m; for(int i = 0;i < n;i++){ cin >> a >> b; m += a-b; res = max(res, m); if(m < 0){cout << 0<< endl;return 0;} } cout << res << endl; return 0; }
ALGO
0.999985
3.706532
fd47db43-cfe5-4536-aad7-ca7fdeb19b02
Galaxy-Nexus-Project/android_frameworks_base
media/libstagefright/codecs/amrnb/common/src/extract_h.cpp
/* Pathname: ./gsm-amr/c/src/extract_h.c ------------------------------------------------------------------------------ REVISION HISTORY Description: Created separate file for the extract_h function. Sync'ed up with the current template and fixed tabs. Description: Removed conditional code that update...
TOOL
0.957451
5.901973
b7807603-3120-46c3-8eec-6569a168bc8d
Avi8010/Data-Structures
Binary tree/build_tree_pi.cpp
#include <iostream> using namespace std; struct node { int data; node* left; node* right; node(int val){ data=val; left=NULL; right=NULL; } }; int search(int in[], int st,int en,int curr ){ for(int i=st;i<=en;i++){ if(in[i]==curr){ return i; } ...
ALGO
0.999998
5.100711
7b55874b-210b-4e27-9eec-5e5ec54466f3
ak47adarsh01/Leetcode-Solutions
350-intersection-of-two-arrays-ii/350-intersection-of-two-arrays-ii.cpp
class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { unordered_map<int, int> freq; vector<int> res; for (auto num : nums1) freq[num]++; for (auto num : nums2) { if (freq[num]) { res.push_back(num); ...
ALGO
0.999966
5.974813
cf52a0ad-5d1e-4d5a-869b-7a392ca759e2
mdarafat1819/Hackerrank
Printing Pattern using Loops.cpp
#include <stdio.h> int main() { int n, col; scanf("%d", &n); for(int i = n; i >= 1; i--) { for(int j = n; j > i; j--) printf("%d ", j); for(int k = 0; k < (1 + (i - 1) * 2); k++) printf("%d ", i); for(int j = i+1; j <= n; j++) printf("%d ", j); printf("\n"); } fo...
ALGO
0.999922
3.424332
82102dc8-ec91-42c1-9bdb-e1ce93faae1b
Abhijit8951/DSA
pairsum/pairsum_optimised.cpp
#include <iostream> #include <vector> using namespace std; vector<int> pairsum(vector<int> nums, int target){ vector<int> ans; int size=nums.size(); int i=0, j=size-1; while(i<j){ int pairsum = nums[i]+nums[j]; if(pairsum < target){ i++; } else if(pairsum > target){ ...
ALGO
0.999964
5.384784
b7429ed0-c941-48d1-9bb3-94d295de86ee
u-noob-i/contest
Codeforces/801 div2/A.cpp
#include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <utility> #include <algorithm> #include <math.h> #include <numeric> #include <queue> #include <climits> using namespace std; int n, m, k, i, j, x; void solve(int T) { cin >> n >> m; vector<vector<int>> arr(n, vecto...
ALGO
0.999791
3.716906
6ea9f81d-559e-4591-aa6c-a93a8e209639
agegold/DH-opkr
selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.cpp
extern "C" { #include "acado_common.h" } #include "INCLUDE/QProblem.hpp" #if ACADO_COMPUTE_COVARIANCE_MATRIX == 1 #include "INCLUDE/EXTRAS/SolutionAnalysis.hpp" #endif /* ACADO_COMPUTE_COVARIANCE_MATRIX */ static int acado_nWSR; #if ACADO_COMPUTE_COVARIANCE_MATRIX == 1 static SolutionAnalysis acado_sa; #endif /* AC...
ALGO
0.99893
5.070384
1927d077-956e-4063-a0c2-53ffe8eb54cd
ishandutta2007/codeforces
marckess/normal/1511/B.cpp
#include <bits/stdc++.h> #define endl '\n' #define fi first #define se second #define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k)) #define forn(i,n) for (int i = 0; i < int(n); i++) #define forr(i,a,b) for (int i = a; i <= b; i++) #define all(v) v.begin(), v.end() #define pb push_back using namespace std; typedef long lo...
ALGO
0.999878
3.627054
d6d86600-f453-4895-927f-49f6b9f95759
nader-grt/Problemsolvingwithcpp
level07/index09.cpp
#include <iostream> #include <cmath> #include <string> #include <limits> #include <cstdlib> #include <ctime> #include <iomanip> #include <vector> #include <fstream> #include <filesystem> #include "../../coursecpp/level05/LibraryOrPackage/MyLib.h" using namespace std ; short IsleapYear(short Year) { re...
TOOL
0.992647
4.149714
ffa7637f-9353-4100-ac13-6dcd77bd53e2
krishnakant2004/DSA
dsa/code/linklist/4length.cpp
#include<bits/stdc++.h> using namespace std; #include "1linklist.h" Node* creat(Node* head){ int data; cin>>data; if(data==-1){ return nullptr; }else{ Node* newnode=new Node(data); newnode->next=creat(newnode->next); head=newnode; } return head; } void print(Nod...
ALGO
0.997607
4.225822
3b705922-c2a9-4524-9fa6-15ab6da47fca
yeswanthsairaghuram/LeetCode
0164-maximum-gap/0164-maximum-gap.cpp
class Solution { public: int maximumGap(vector<int>& nums) { int n=nums.size(); sort(nums.begin(),nums.end()); if(n<2) return 0; int maxs=0; for(int i=0;i<n-1;i++){ maxs=max(maxs,nums[i+1]- nums[i]); } return maxs; } };
ALGO
0.999976
5.317019
101d5368-f387-43e5-9748-039c21f2b40c
Prahlad-07/Leetcode
0951-partition-array-into-disjoint-intervals/0951-partition-array-into-disjoint-intervals.cpp
class Solution { public: int partitionDisjoint(vector<int>& nums) { int left=nums[0]; int maxi=nums[0]; int ans=0; for(int i=1;i<nums.size();i++){ if(left>nums[i]){ ans=i; left=maxi; } maxi=max(maxi,nums[i]); ...
ALGO
0.999973
5.697439
9460facc-bd57-4a01-8bba-1bb63a645492
Remsely/mirea-data-structures-and-algorithms
practise3/HashTable.cpp
// // Created by proko on 30.09.2023. // #include "HashTable.h" HashTable::HashTable() { for(auto & el : table){ el = nullptr; } } int HashTable::hashFunction(const string& key) { int hash = 0; for(char ch : key) hash += static_cast<int>(ch); return hash % TABLE_SIZE; } int HashT...
ALGO
0.965018
4.856253
1f1d1ce8-286c-4c58-b798-065d1b9630c9
AYUSH-002/LEETCODE
0506-relative-ranks/0506-relative-ranks.cpp
static int speedup = []() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(0); return 0; }(); class Solution { public: vector<string> findRelativeRanks(vector<int>& score) { priority_queue<pair<int, int>> pq; int n = score.size(); for(int i = 0; i < n; i++) { pq.push...
ALGO
0.999913
5.843583
5e99ca5b-99f8-48c3-afb6-2e4d39a6b8e5
Yangsx-1/leetcode-c
0-500/0204.cpp
// finished in 2024.2.6 class Solution { public: int countPrimes(int n) { if (n <= 2) return 0; vector<bool> isprime(n, true); int ans = 0; for (int i = 2; i < n; ++i) { if (isprime[i]) { ++ans; for (long long j = (long long)i * i; j < n; j...
ALGO
0.999973
6.04356
1e390fa0-9b67-4e8e-974c-cd5f57d48da3
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_1893_8.cpp
#include <bits/stdc++.h> using namespace std; char A[105][105]; int dist[105][105]; int P[1000006]; int X[1000006], pre[1000006]; int main() { ios_base::sync_with_stdio(0), cin.tie(0); int N; cin >> N; for (int i = 1; i <= N; ++i) cin >> A[i] + 1; for (int i = 1; i <= N; ++i) { for (int j = 1; j <= N; ++j...
ALGO
0.999994
3.863786
77c35a32-6c96-4683-a986-6c76d76ab018
Laplace825/algorithm-road
DS/tree-forest/main.cpp
#include "tree-forest.hpp" #include <memory> #include <vector> #include <chrono> class TimerKeeper { public: TimerKeeper() : start_time(std::chrono::high_resolution_clock::now()) {} ~TimerKeeper() { auto end_time = std::chrono::high_resolution_clock::now(); auto duration = std::...
ALGO
0.87646
4.439056
269e89cf-a8f2-422b-916d-8f0ec24f3f78
VitamintK/AlgorithmProblems
UVA/uva10738_riemann_vs_mertens.cpp
#include <bits/stdc++.h> #include <string> #define ll long long #define ull unsigned long long using namespace std; int main(){ std::ios::sync_with_stdio(false); vector<int> sieve(1000003, -1); //sieve[x] contains x's largest prime factor //vector<int> is_square(1000003); //for convenience's sake. we could also c...
ALGO
0.999156
3.39386
54636064-33d0-4ce7-aee8-2c556884df15
xcszbdnl/TrainingCode
AcmCode/codeforces_275_a.cpp
#include <cstdio> #include <cstring> const int maxn = 100007; int val[maxn], n, k; int vis[maxn]; int main() { // freopen("in.txt", "r", stdin); memset(vis, 0, sizeof(vis)); scanf("%d%d", &n, &k); if (k == 1) { for (int i = 1; i <= n; i++) { printf("%d ", i); } print...
ALGO
0.999988
3.376465
744ad366-6fac-4273-a9a4-dea1d6014f89
SalikYousuf/oopsCollege
daysInMonth.cpp
#include <iostream> using namespace std; int main() { int month; cout << "Enter the month number (1-12): "; cin >> month; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout << "31 days in this month." << endl; break; case...
TOOL
0.910316
3.742548
bba0820d-eaad-4e36-b60f-22583474ef84
MuhamedAbdallaMuhamed/MyProblemSolving-Contest-Solutions
CodeForces/NCD 19/E/main.cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, MOD = 1e9 + 7; long long pw[2][N], segtree[2][2][(N + 5) * 4]; string s, ss; void mrg(int indx, int pos) { segtree[indx][0][pos] = (segtree[indx][0][2 * pos] + segtree[indx][0][2 * pos + 1]) % MOD; segtree[indx][1][pos] = (segtree[indx][1][...
ALGO
0.999516
5.025196
cd6efb0d-4ca8-438e-a9a1-3b1872384391
bharabhi01/LeetCode-Questions
33-search-in-rotated-sorted-array/33-search-in-rotated-sorted-array.cpp
class Solution { public: int search(vector<int>& nums, int target) { int low = 0, high = nums.size()-1; while(low<=high) { int mid = (low+high)/2; if(nums[mid] == target) return mid; if(nums[low]<=nums[mid]) ...
ALGO
0.999966
6.215664
2ffdebd9-0a07-45c9-9cd0-9be68446f580
mdtariqueh007/My_GFG
Medium/Largest subsquare surrounded by X/largest-subsquare-surrounded-by-x.cpp
//{ Driver Code Starts // Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends // User function Template for C++ class Solution { public: int largestSubsquare(int n, vector<vector<char>> a) { // code here vector<vector<pair<int,int>>> dp(n,vector<pair<int...
ALGO
0.999565
6.175939
f06a7a6a-4d38-41f5-a276-d6a57a52eab9
jmjeon2/algorithm
15686_치킨배달.cpp
#include<iostream> #include<vector> using namespace std; int map[50][50]; vector<pair<int,int> > home; vector<pair<int,int> > chicken; int visit[13]; int n,m; int tmp; int mini=10000; int sum; int result=10000; int abs(int a){ if(a<0) return -a; else return a; } void dfs(int v, int depth){ visit[v]=1; if(depth==m...
ALGO
0.999795
3.209441
cd2baed1-3be7-4efe-9fcf-04df90eaf9af
zstenger93/CPP
CPP09/ex01/src/RPN.cpp
#include "../includes/RPN.hpp" /*__________________________________ CONSTRUCTORS / DESTRUCTOR __________________________________*/ RPN::RPN() {} RPN::~RPN() {} RPN::RPN(RPN const &cpy) { *this = cpy; } /*_____________________________________ OPERATOR OVERLOADS ______________________________________*/ RPN &RPN::oper...
ALGO
0.922471
4.766558
01967db8-8cfb-49d7-92aa-c9514a910dda
DavidSaxon/ArcaneCore
src/cpp/arcanecore/config/Document.cpp
#include "arcanecore/config/Document.hpp" #include <arcanecore/base/Exceptions.hpp> #include <arcanecore/io/sys/FileReader.hpp> #include <json/json.h> namespace arc { namespace config { //------------------------------------------------------------------------------ // PRIVATE STATIC ATTRI...
TOOL
0.89327
7.368925
65eebcd6-4b60-412a-b102-4eb2f20ac6b1
aiqinxuancai/AutoLinker
src/StringHelper.cpp
#include <iostream> #include <string> #include <vector> #include <fstream> #include <sstream> #include <string> #include <vector> #include <filesystem> std::string ReplaceSubstring(std::string source, const std::string& toFind, const std::string& toReplace) { size_t pos = 0; while ((pos = source.find(toFind, p...
TOOL
0.929861
4.600043
bf59db16-8d8b-4779-afb9-120f3f208c3e
Prat-2002/Week1-DSA1-CipherSchools
Lecture10/Power.cpp
#include<bits/stdc++.h> using namespace std; vector<vector<int>> power(vector<int>& nums){ vector<vector<int>> TotalSubsets; int n=nums.size(); for(int num=0;num<=pow(2,n)-1;num++){ vector<int> sub; for(int i=0;i<=n-1;i++){ if(num&(1<<i)){ ...
ALGO
0.999876
4.5198
eac59c54-9bf9-4c3e-9dd1-303319b166b4
Sagargupta16/DS-Implementations
08_Stack/02_StckUsingLL.cpp
#include <iostream> using namespace std; class Node { public: int data; Node *next; Node(int d) { data = d; next = NULL; } }; template <class T> class LinkedList { private: Node *head; public: LinkedList() { head = NULL; } void insertAtStart(T d) { ...
ALGO
0.993374
4.94488
48205b80-350f-48a4-82d0-ec3e299db7bd
ishandutta2007/codeforces
ftiasch/normal/1418/B.cpp
#line 1 "sol.cpp" #include <bits/stdc++.h> const int N = 100; int n, a[N], l[N]; int main() { int T; scanf("%d", &T); while (T--) { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", a + i); } std::vector<int> v; for (int i = 0; i < n; ++i) { scanf("%d", l + i); if...
ALGO
0.999911
3.003126
46ddd817-d014-408b-a43b-266fb97e4fb4
mahinuralam/LeetCode-solutions
27-remove-element/27-remove-element.cpp
class Solution { public: int removeElement(vector<int>& nums, int val) { sort(nums.begin(), nums.end()); vector<int>ans; for(int i = 0; i < nums.size(); i++) { if(nums[i] != val) { ans.push_back(nums[i]); } } ...
ALGO
0.999939
6.221533
cf484f35-0d26-4411-b7e7-9a4ce62646df
ishandutta2007/codeforces
rubikun/normal/634/C.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define fi first #define ...
ALGO
0.999785
4.276984
c180a84d-b8e3-4236-bf33-8a1d763db0f5
octavcosmin/programming-projects
CPP/pbinfo.ro/#99_NrAparitii/main.cpp
#include <cstdio> using namespace std; int n, last, aparitii; int main() { FILE *in = fopen("nraparitii.in", "r"); fscanf(in, "%d", &n); for(int i = 0; i < n; ++i) fscanf(in, "%d", &last); fclose(in); in = fopen("nraparitii.in", "r"); fscanf(in, "%d", &n); for(int i = 0; i < n; ...
ALGO
0.999597
3.332139
9c220556-2a2a-4d2f-aedd-215a43788fdc
lccycc/leetcode
Valid Parentheses.cpp
class Solution { public: bool isValid(string s) { stack<char> stk; for (int i = 0; i<s.size(); i++){ if (s[i] == '(' || s[i] == '[' || s[i] == '{') stk.push(s[i]); else{ if (stk.size() == 0) return false; char tp = stk.top(); st...
ALGO
0.999658
6.325752
ab14e56b-e96f-4100-b6e1-81505cb7a77f
Charbel-11/Competitive-Programming
Contests/Codeforces/552 Div3/F-Shovel's Shop Bottom Up.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <climits> using namespace std; int main() { int n, numOffers, numToBuy; vector<int> shovels; vector<pair<int, int>> sO; cin >> n >> numOffers >> numToBuy; for (int i = 0; i < n; i++) { int t; cin >> t; shovels.push_back...
ALGO
0.99996
4.377096
96277c37-4e64-4ee2-8733-6a81bd6461ce
Giavonator/Competitive-Programming
USACO/Practice/forestQueries.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int n, q; cin >> n >> q; vector<vector<int> > grid(n + 1, vector<int>(n + 1)); for(int i = 1; i <= n; i++){ string line; cin >> line; for(int x = 1; x <= n; x++){ int num = line[x-1] == '*' ? 1 : 0; grid[i][x] = grid[i][x-1] + num; } } ...
ALGO
0.999774
3.791945
eb1d859f-00fd-4631-9daa-427d7fa36b5f
ChitreshApte/Data-Structures-and-Algorithms-CPP
Bridges-in-Graph.cpp
//Tarjan's Algorithm #include<bits/stdc++.h> using namespace std; vector< vector<int> > adj, ans; vector<bool> visited; vector<int> discovery; //the first time we discover this node vector<int> low; //the earliest possible time at which the node discovered is accessible from here //in the process of finding the low v...
ALGO
0.999988
4.288072
0b1bf11c-bec9-45ac-92ec-6d9c620eddf0
himanshuZT/Oops
Q4.cpp
#include<iostream> using namespace std; int maximum(int arr[],int n){ int max=0; for(int i=0;i<n;i++){ int k=2; int total=n-i-1; int c=i+1; int sum=arr[i]; while(total-k>=0){ for(int j=c;j<c+k;j++){ sum=sum+arr[j];} c=c+k; total=total-k; ...
ALGO
0.999945
4.573634
5de2a99a-1de3-4100-a429-f7b588334b2f
kmjp/procon
yuki/1001-2000/1301-1400/1348.cpp
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define ...
ALGO
0.99994
4.891505
e428626b-3399-4ec9-9214-4b6cfc7336d2
homedory/codetree-TILs
240224/자연수 n개의 합/sum-of-n-natural-numbers.cpp
#include <iostream> using namespace std; int main() { long long s; cin >> s; long long l = 1, r = 2000000000; long long ans = 0; while(l <= r) { long long mid = (l + r) / 2; if (mid * (mid + 1) / 2 <= s) { l = mid + 1; ans = max(ans, mid); } ...
ALGO
0.999426
4.293679
2e18a689-7def-42dc-a528-f78bdd4f96f7
youngjinkim0706/splab_godot
thirdparty/meshoptimizer/clusterizer.cpp
#include <assert.h> #include <math.h> #include <string.h> // This work is based on: // Graham Wihlidal. Optimizing the Graphics Pipeline with Compute. 2016 // Matthaeus Chajdas. GeometryFX 1.2 - Cluster Culling. 2016 // Jack Ritter. An Efficient Bounding Sphere. 1990 namespace meshopt { static void computeBoundingSph...
ALGO
0.997636
3.384146
256453d2-aaa8-4993-a089-02b6a749661e
Tangsmallrong/LeetCode
HOT100/C++/543.二叉树的直径.cpp
/* * @lc app=leetcode.cn id=543 lang=cpp * * [543] 二叉树的直径 */ // @lc code=start /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), r...
ALGO
0.999927
6.777093
66f3a999-ae5f-4851-b441-6b6f418cdaa7
FirstKhoi/DSA
codeForces/A/231A.cpp
#include<bits/stdc++.h> #include<vector> using namespace std; using ll = long long; //https://codeforces.com/contest/231/problem/A int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int ans = 0; while (n--) { int a, b, c; cin >> a >> b >> c; ans += (a + b + c...
ALGO
0.999193
4.778737
0045bbe3-19f9-4e90-883d-8b7b0937fb22
arjunpanicker/HATS-CPP
src/ft/src/autotune.cpp
#include "autotune.h" #include <algorithm> #include <csignal> #include <functional> #include <iomanip> #include <iostream> #include <random> #include <thread> #define LOG_VAL(name, val) \ if (autotuneArgs.verbose > 2) { \ std::cout << #name " = " << val << std::endl; \ }...
TOOL
0.920205
7.075985
b85a1231-18a7-475b-af59-4a30beb644bb
honood/leetcode
solutions/0005-longest-palindromic-substring.cpp
// HoNooD <<EMAIL>> // 2024.07.08 15:27 // 5. Longest Palindromic Substring // https://leetcode.com/problems/longest-palindromic-substring/description/?envType=study-plan-v2&envId=top-interview-150 // https://en.wikipedia.org/wiki/Longest_palindromic_substring // https://en.wikipedia.org/wiki/Dynamic_programming aut...
ALGO
0.999781
6.991838
4d073f68-5c0a-427b-9798-b2638178b952
siluhuayu/LeetCode
LeetCode6.cpp
#include<iostream> #include<string> #define N 1000 using namespace std; string convert(string s, int numRows){ string zs = ""; int len = s.length(); char z[N][N]={}; int m = 0, n = 0; if(numRows == 1) zs = s; else{ for(int i = 0; i < len; i++) { if(m < numRows && ( n == 0 || (n % (numRows - 1)) == 0 )){ ...
ALGO
0.999915
3.823575