Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Good pairs
#include <bits/stdc++.h> using namespace std; int main() { int numsSize; cout<<"Enter the total size in nums:"<<endl; cin>>numsSize; int nums[numsSize]; for(int k=0;k<numsSize;k++) {cin>>nums[k];} int i,j,count=0; for(i=0;i<numsSize;i++) { for(j=0;j<numsSize;j++) { if(nums[i]==nums[j] and i<j) {count=count+1;} } } cout<<"Good pairs is: "<<count; return 0; }
run
|
edit
|
history
|
help
1
scemo le
volatile thread-safe object
Guess Number
Search in a rotated sorted array two methods
derivative
ThreadPool
Dar
lab17feb22x4B.cpp
Chinu
basic observation leads to dp OPTIMIZATION from O(n^3) to O(n^2) !!! (sopj : AMBLE)