cody - HTMLify profile
files of /cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/
Check if array is sorted.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Check if array is sorted.cpp
class Solution {
public:
bool arraySortedOrNot(int arr[], int n) {
for(int i=0;i<n-1;i++){
if(arr[
public:
bool arraySortedOrNot(int arr[], int n) {
for(int i=0;i<n-1;i++){
if(arr[
#include <bits/stdc++.h>
vector<int> completeSum(vector<int> &a, int n) {
// Write your code here.
int i =0;
vector
vector<int> completeSum(vector<int> &a, int n) {
// Write your code here.
int i =0;
vector
Find the element that appears once.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Find the element that appears once.cpp
class Solution{
public:
int search(int A[], int N){
//code
int xor1 = 0;
for(int i=0 ;i<N; i++){
xo
public:
int search(int A[], int N){
//code
int xor1 = 0;
for(int i=0 ;i<N; i++){
xo
Largest Element in Array.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Largest Element in Array.cpp
class Solution
{
public:
int largest(vector<int> &arr, int n)
{
int large = arr[0];
for(
{
public:
int largest(vector<int> &arr, int n)
{
int large = arr[0];
for(
Left Rotate an array by one place.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Left Rotate an array by one place.cpp
class Solution{
public:
void leftRotate(int arr[], int k, int n)
{
// Your code goes here
k = k % n;
public:
void leftRotate(int arr[], int k, int n)
{
// Your code goes here
k = k % n;
int linearSearch(int n, int num, vector<int> &arr)
{
// Write your code here.
for(int i =0; i<n; i++){
if(ar
{
// Write your code here.
for(int i =0; i<n; i++){
if(ar
Majority Element - II.cpp(CN)
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Majority Element - II.cpp(CN)
#include <bits/stdc++.h>
vector<int> majorityElementII(vector<int> &arr)
{
// Write your code here.
map<int, int>mpp;
vector<int> majorityElementII(vector<int> &arr)
{
// Write your code here.
map<int, int>mpp;
Max Consecutive Ones.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Max Consecutive Ones.cpp
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans = 0;
int temp = 0;
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans = 0;
int temp = 0;
Merge Sorted Array(LC).cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Merge Sorted Array(LC).cpp
for (int j = 0, i = m; j<n; j++){
nums1[i] = nums2[j];
i++;
}
sort(nums1.begin(),nums1.e
nums1[i] = nums2[j];
i++;
}
sort(nums1.begin(),nums1.e
int missingNumber(int A[], int N)
{
// Your code goes here
int xor1 = 0;
int xor2 = 0;
for(int i=0; i
{
// Your code goes here
int xor1 = 0;
int xor2 = 0;
for(int i=0; i
#include <bits/stdc++.h>
void moveZerosToLeft(int *arr, int n)
{
int i=n-1;
for(int j=n-1;j>=0;j--){
void moveZerosToLeft(int *arr, int n)
{
int i=n-1;
for(int j=n-1;j>=0;j--){
Move all zeroes to end of array.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Move all zeroes to end of array.cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> moveZeros(int n, vector<int> a) {
int j = -1;
//place th
using namespace std;
vector<int> moveZeros(int n, vector<int> a) {
int j = -1;
//place th
Non-Repeating Element.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Non-Repeating Element.cpp
class Solution{
public:
int firstNonRepeating(int arr[], int n)
{
// Complete the function
map<int
public:
int firstNonRepeating(int arr[], int n)
{
// Complete the function
map<int
#include <bits/stdc++.h>
int oneIteration(vector<int> A)
{
// Write your code here.
int n = A.size();
int largest
int oneIteration(vector<int> A)
{
// Write your code here.
int n = A.size();
int largest
Remove duplicate elements from sorted Array.cpp
/cody/pratham0709/Striver-A-TO-Z-SDE-SHEET/Array/Easy/Remove duplicate elements from sorted Array.cpp
class Solution{
public:
int remove_duplicate(int a[],int n){
// code here
int i = 0;
for(int j
public:
int remove_duplicate(int a[],int n){
// code here
int i = 0;
for(int j
class Solution {
public:
void rotate(vector<int>& nums, int k) {
// Brute Force Approch{
// k = k % nu
public:
void rotate(vector<int>& nums, int k) {
// Brute Force Approch{
// k = k % nu
class Solution{
public:
// Function returns the second
int secondlargest(int arr[], int n){
int largest = arr[0];
public:
// Function returns the second
int secondlargest(int arr[], int n){
int largest = arr[0];