Search
 
SCRIPT & CODE EXAMPLE
 

CPP

equal elements in two arrays in c++

bool equalelementsintwoarrays(int A[], int B[], int N) {
    sort(A, A+N);
    sort(B, B+N);
    int i = 0, j = 0;
    while (i < N && j < N) {
        if (A[i] == B[j]) return true;
        else if (A[i] > B[j]) j++;
        else i++;
    }
    return false;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c vs c++ vs c# 
Cpp :: C++ Counting 
Cpp :: aliasing c++ 
Cpp :: c++ loop array 
Cpp :: accumulate in c++ 
Cpp :: cpp set time 
Cpp :: c++ pwstr to char* 
Cpp :: english to french typing online 
Cpp :: c++ switch case statement 
C :: how to slow voice speed in pyttsx3 
C :: What are the 3 basic types of Plate Boundaries? Explain their differences (how they act). 
C :: .gitkeep file 
C :: classification report to excel 
C :: save numpy array to text file 
C :: string to int c 
C :: how to print int in c 
C :: windeployqt example 
C :: random in c 
C :: que es % en c 
C :: concatenate char * c 
C :: how to create calculator with switch in c 
C :: Graphics in C Draw Circle 
C :: go optional parameters 
C :: go Iterating over an array using a range operator 
C :: ruby find object in array by attribute 
C :: print a part of string c 
C :: c convert float to string 
C :: passing two dimensional array to function in c 
C :: c remove last charachter from string 
C :: malloc c 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =