Code with Cisco OA Help : Interview Help
916 subscribers
413 photos
2 videos
29 links
Codeforces
Codechef
Leetcode
AtCoder
GFG
CodeStudio

All Contests Solutions available.
Download Telegram
E solution
Find the smallest element index and if the array is sorted from there then print its index otherwise if not sorted print -1
void code()
{
int n;
cin >> n;
vector<int> arr(n);
for (int &i : arr)
cin >> i;
int minIndex = 0;
for (int i = 0; i < n; i++)
if (arr[i] < arr[minIndex])
minIndex = i;
int res = minIndex;
for (int i = minIndex; i < n - 1; i++)
if (arr[i] > arr[i + 1])
res = -1;
cout << res << endl;
}

// E
// Enjoy โค๏ธ
โค11๐Ÿ‘Ž4๐Ÿ‘1
A and B done โœ… codeforces
Dm fast, time's running ๐Ÿ˜
Anyone wants to buy 4 โญ๏ธ codechef id, dm me ๐Ÿ’ซ
@cp_wala
Anyone wants to buy Leetcode Guardian ID dm me ๐Ÿ˜
@cp_Wala
๐Ÿ‘Ž2๐Ÿ”ฅ1
Channel name was changed to ยซCodeforces and Codechef Solutionsยป
A done codeforces ๐Ÿ˜
CF B done โœ…
Leetcode D done ๐Ÿ˜ dm fast
C done โœ… ๐Ÿ˜
๐Ÿ”ฅ2๐Ÿ‘1๐Ÿ˜ฑ1
anyone wants 4 star codechef id in minimum price, dm me @cp_wala
Codeforces A done โœ…
Codeforces B done โœ… ๐Ÿ˜
Codeforces C done