Target Sum | Intermediate Coding Practice in Arrays | Lecture 16 | Java and DSA Foundation

preview_player
Показать описание
Aren't arrays amazing? They enable us to solve complex problems conveniently.
Now, that you are familiar with the basics of arrays from the last class, Manvi mam will solve some tricky and frequently asked problems in exams and placements, based on the concept of target sum and array manipulation! Excited?!
Join the class to level up your logic building and understanding of arrays.

Are you finding the classes helpful?
Stay tuned for more!

If you are joining us late, to know more about PWSkills & plans :

▶️ PW Skills LinkedIn Channel -

Timestamps:
00:00 - Introduction
00:45 - Recap
02:08 - Today's Checklist
03:52 - Program to find the total number of pairs in the arrays whose sum is equal to the given value x
11:00 - Program to count the number of triplets whose sum is equal to the given value x
15:15 - Code
17:22 - Dry run
27:14 - Program to find a unique number in a given array
31:35 - Code
34:20 - Program to find the second-largest element in the given array
39:02 - code
45:44 - Dry run
49:10 - For an array of integers return the first value that is repeating in the array
52:25 - Code
55:43 - Dry run
1:01:20 - Summary of lecture

#Java #IntroductiontomethodsinJava #JavaMethods #PWskills #PhysicsWallah #Coding #LearnCoding #JavaArrays #HowToCode #ArraysinJava #2DArrays #IntroductiontoArray #ArrayinJava #Programming #Java #Programming
Рекомендации по теме
Комментарии
Автор

मैंम आपका सिखाने का तारिका बहुत अच्छा है... मैं आप से ये आशा करता हूँ कि जो आप लेक्चर के बाद इसी तरह प्रशन करवाऐ इस से समझने मे आसानी होती हैं

sparsh-
Автор

Hearty Thank you college wallah for providing us java lecture from basic to

modanwalpriti
Автор

For obtaining last elements that's repeated direction of loop will be opposite.

cs-rohitsahu
Автор

mam a really grateful to you because i am afraid from this type of question but now i will solve without seeing you answer

sumittiwari
Автор

For last repeating val :- we will not return the arr[i] inside if condition, we will store arr[i] in a variable(ans) and return outside the for loop. In starting we also have to initialize ans variable with -1.

harshguleri
Автор

34:20 - Program to find the second-largest element in the given array
mam ap ka explanation bhohat hi achha hai but ye code thoda difficult hai or jyada bada bhi hai
or ek begginer ko nahi samj me ayenga

static int secLarge(int[] arr){
int largest = Integer.MIN_VALUE;
int sl = 0;
for (int i=0; i<arr.length; i++){
if(arr[i]>largest){
sl = largest;
largest = arr[i];
}
}
return sl;
}
i thik is se kam ho jana chahiye or ye assy bhi hai

shaikhanis
Автор

thank u mam for giving us a very good course in free with outstanding explaination

KamleshKumarYadav-fu
Автор

Timestamps:
00:00 - Introduction
00:45 - Recap
02:08 - Today's Checklist
03:52 - Program to find the total number of pairs in the arrays whose sum is equal to the given value x
11:00 - Program to count the number of triplets whose sum is equal to the given value x
15:15 - Code
17:22 - Dry run
27:14 - Program to find a unique number in a given array
31:35 - Code
34:20 - Program to find the second-largest element in the given array
39:02 - code
45:44 - Dry run
49:10 - For an array of integers return the first value that is repeating in the array
52:25 - Code
55:43 - Dry run
1:01:20 - Summary of lecture

narutodihargo
Автор

import java.util.Scanner;

public class LastReapeating {
static int LastRepeatingNumber(int[] array_1){
int n = array_1.length;
int lastrepeatingnumber = -1;

for (int i = 0; i < n; i++) {//first number
for (int j = i+1; j < n; j++) { //second number
if (array_1[i] == array_1[j]){ //found ans
lastrepeatingnumber = array_1[i];
}
}
}
return lastrepeatingnumber;
}

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter array size");
int n = sc.nextInt();
int[] array = new int[n];

System.out.println("Enter " + n + " Elements");
for (int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}

System.out.println("Last Repeating Number is : "+ LastRepeatingNumber(array));
}
}

Sandeep_Yadav
Автор

very clear and understanding lecture by u mam...really helpful thanks to college wallah

sunrisetravels-oo
Автор

Mam from where we can practice coding questions topicwise...

chiragagrawal
Автор

public class LastRepeatingValue {
public static int findLastRepeating(int[] arr) {
// Traverse the array from the end
for (int i = arr.length - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {
if (arr[i] == arr[j]) {
return arr[i]; // Return the last repeating value
}
}
}
return -1; // Return -1 if no repeating value is found
}

public static void main(String[] args) {
int[] array = {3, 5, 1, 3, 4, 5};
// Output: 5
}
}

SangeetNagar-rd
Автор

For finding second max also we can use sort the array in ascending order and print the last second digit

arvindkumarmishra
Автор

Notes and Assignments kaha se download kare . Ye wali link to work hi nahi kar rahi hai

RanjeetYadav-zieh
Автор

in the finding unique element. We can also use break; statement instead of assigning the element to -1.

rakeshroy_
Автор

Mam aap typing ke time kuch short cut use karti Hai please aap short video ke through uske batye.
Like: From keyboard how to select specific row not all

distancelearning
Автор

Mam I'm sorry for not consistent on your course
I'll watch it later
After completing my backlog

zeeshaxnn
Автор

lastValueRepeat code

static int lastValueRepeat(int[] arr){
int valrepeat = -1;

for (int i = 0; i < arr.length; i++) {
for (int j = i+1; j < arr.length; j++) {
if(arr[i]==arr[j]){
valrepeat= arr[i];
}
}
}
return valrepeat;
}

girishpatil
Автор

Someone help me! I can not access assignment. plese share link in the comment.

Gandhipatel-jjdz
Автор

Add more leetcode problem solving sessions mam ♥️

fcanjalipatil
join shbcf.ru