Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/MinGW/bin/g++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"iostream": "cpp"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <bits/stdc++.h>
using namespace std;

int maxSubArraySum(int arr[], int size)
{
int maximum = INT_MIN, ending = 0,
start = 0, end = 0, s = 0;

for (int i = 0; i < size; i++) {
ending += arr[i];

if (maximum < ending) {
maximum = ending;
start = s;
end = i;
}

if (ending < 0) {
ending = 0;
s = i + 1;
}
}
return maximum;
}

/*Driver program to test maxSubArraySum*/
int main()
{
int size;
cin>>size;
int array[size];
for (int i = 0; i < size; i++)
{
cin>>array[i];
}
int max_sum = maxSubArraySum(array, size);
cout<<max_sum;
return 0;
}
Binary file not shown.
36 changes: 36 additions & 0 deletions coding_freshmen/C++/Abhishek_Dwibedy/AbhishekDwibedy_Sort01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include<bits/stdc++.h>
using namespace std;


void sort(int arr[], int n)
{
int j = -1;
for (int i = 0; i < n; i++) {

// if number is smaller than 1 then swap it with j-th number
if (arr[i] < 1) {
j++;
swap(arr[i], arr[j]);
}
}
}


int main(){
int size;
cin>>size;
int array[size];
for (int i = 0; i < size; i++)
{
cin>>array[i];
}
sort(array,size);
for (int i = 0; i < size; i++)
{
cout<<array[i]<<" ";
}
cout<<endl;
return 0;
}


Binary file not shown.
34 changes: 34 additions & 0 deletions coding_freshmen/C++/Abhishek_Dwibedy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 1.Title of the Problem:Sort_array

You are given an array of 0s and 1s in random order.

# Problem Explanation 🚀

Basically , we have to sort the input array in terms of 0 and 1 in ascending order.

# Your logic 🤯

- simply we have to sorting the array in ascending order.

# Time Complexity and Space Complexity

Time Complexity -> O(n)
Space Complexity -> O(1)



# 2. Problem Title: MAXIMUM_SUM

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

# Problem Explanation

A subarray is a contiguous part of an array.

# Logic and Intuition

- Here the logic that i applied is to add the numbers from starting index, if it's found greater than the sum then this value will be assigned to the sum, if the addition value become negative, then it's made 0.
# Time Complexity and Space Complexity

- Time Complexity: O(n)
- Space Complexity: O(1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import cv2 as cv
import pyautogui as win

img = cv.VideoCapture(0)

while True:
isTrue, frame = img.read()
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
haar_cascade = cv.CascadeClassifier('haar_face.xml')
faces_rect = haar_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=4)
print(f'{len(faces_rect)} face(s) detected')
faces = f'{len(faces_rect)} face(s)'

cv.putText(frame, faces, (0,25), cv.FONT_HERSHEY_TRIPLEX, 1.0, (0,0,255), thickness=2)
for (x,y,w,h) in faces_rect:
cv.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), thickness=2)

cv.imshow('Video',frame)
if cv.waitKey(20) & 0xFF==ord('d') :
break

img.release()
cv.destroyAllWindows()
Loading