Skip to content

Instantly share code, notes, and snippets.

View vrn25's full-sized avatar
:electron:
Thinking

Videh Raj Nema vrn25

:electron:
Thinking
View GitHub Profile
// Problem for week 1 codebuddy IEEE: https://www.interviewbit.com/problems/largest-number/
bool comp(string a, string b){
string f1 = a+b;
string f2 = b+a;
return f1>f2?1:0;
}
string Solution::largestNumber(const vector<int> &A) {
if(!accumulate(A.begin(),A.end(),0))
return "0";
// Problem for week 1 codebuddy web club: https://www.interviewbit.com/problems/max-distance/
int Solution::maximumGap(const vector<int> &A) {
vector<pair<int,int>>v;
int n = A.size();
for(int i=0;i<n;i++){
v.push_back(make_pair(A[i],i));
}
sort(v.begin(),v.end());
int largest, max_diff;
largest = v[n-1].second;