Skip to content

Instantly share code, notes, and snippets.

View adityamangal1's full-sized avatar
:octocat:
Focusing

Aditya Mangal adityamangal1

:octocat:
Focusing
View GitHub Profile
// C++ program for the above approach
#include <bits/stdc++.h>
using namespace std;
int countTriplets(int arr[], int N)
{
// Sort the array
sort(arr, arr + N);
// Stores count of triplets
int l, r, i, j, ans = 0;
// C++ program for the above approach
#include <bits/stdc++.h>
using namespace std;
// Function to find the Kth element in a
// sorted and rotated array at random point
int findkthElement(vector<int> arr, int n, int K)
{
// Set the boundaries for binary search