Closed Gaurang-Agrawal1 closed 1 year ago
Could you please provide and sample input-output and related screen shots
Hi I have knowledge over C, C++, Python and JAVA and know how to solve pointer operations therefore I would like to work on this issue. I can provide proper documentation and comments in the code. Can you please assign me this issue under SSoC'23? @Kumar-laxmi
@Kumar-laxmi Hey, I have good knowledge about 2 pointers. Can you assign me it?
I WOULD LOVE TO CONTRIBUTE TO THIS ISSUE. HAVE GOOD KNOWLEDGE OF JAVA AND CAN PROVIDE OPTIMISED AND GOOD RESULTS.
@Kumar-laxmi I would love to work on this issue under SSOC'23, as I had good knowledge about this algorithm, can you assign this task to me?
@Kumar-laxmi Can you please assign me this issue i have good knowledge of algorithms
Two Pointer Approach can be applied to a variety of problems involving arrays and linked list data structures. Some most common problems are,
Detecting cycles in linked lists (fast and slow pointers)
here's my solution for finding pairs with specific sum in c++.
`bool pairSum(vector
while (i < j) { if (A[i] + A[j] == targetSum) return 1; else if (A[i] + A[j] < targetSum) i++; else j--; } return 0; }`
the above case works only for sorted array Time Complexity: O(n) Space Complexity: O(1)
alternately we can explicitly sort the array which would cause Time Complexity: O(n log n) //sort function Space Complexity: O(1)
"IF YOU WANT TO ME TO MAKE SOLUTIONS FOR ALL THE PROBLEMS THAT COME UNDER TWO POINTER APPROACH , I CAN MAKE IT AS WELL IN ALL THESE LANGUAGES(JAVA, PYTHON, C, C++). MY SOLUTIONS WILL BE EFFICIENT AND READABLE. GRANT ME THIS ISSUES AND GET A PACKAGE OF EFFICIENT SOLUTIONS FOR PROBLEMS THAT COMES UNDER TWO POINTER APPROACH"
Can you please assign me this issue i have good knowledge of algorithms. I have solved 900+ DSA Problems in various Coding Platforms. I have solved many problems of two pointer algorithms.
@Kumar-laxmi I have a good knowledge around this topic as I am doing Competitive coding for quite some time now and have solved many question based on this algorithm so can you kindly assign me this issue?
Thanks for consideration!
@Kumar-laxmi I can implement in python. I'm proficient in python and I participate in various coding competitions. So can you please assign it to me?
Can you assign this issue to me @Kumar-laxmi i can do it in C,C++ and python
Could you please provide and sample input-output and related screen shots
okk @Kumar-laxmi here is the explanation
Here is the code with Output :-
// Using Two-pointers Technique import java.util.*; class TwoPointer {
public static int findingSum(int arr[], int N, int X)
{
// first pointer
int i = 0;
//second pointer
int j = N - 1;
while (i < j) {
// checking a pair
if (arr[i] + arr[j] == X)
return 1;
else if (arr[i] + arr[j] < X)
i++;
else
j--;
}
return 0;
}
//Main class input
public static void main(String[] args)
{
int arr[] = {1, 2, 3,4, 5, 6,};
int val = 9;
int arrSize = arr.length;
System.out.println(findingSum(arr, arrSize, val));
}
}
Output 1 :-
Example 2- In this target is 29 which does not exist , so output is 0 .
So, this is the explanation @Kumar-laxmi please assign this issue to me , now I have completely explained it.
Please don't raise LeetCode, GFG or HackerRank, etc
Two pointer : -
The two-pointer technique is a search algorithm used to solve problems involving collections such as arrays and lists by comparing elements pointed by two pointers and updating them accordingly.
Feature : -
Add 2 Pointer Algorithm in C++ , C , java , python.
Description of solution :-
Alternatives Considered :
@Kumar-laxmi Can you please assign me this issue under SSoC'23 so that I can send in a PR on 1st June ?