2. Add Two Numbers
Level :-
Medium
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example 1:
Input: l1 = [2,4,3], l2 = [5,6,4]
Output: [7,0,8]
Explanation: 342 + 465 = 807.
Example 2:
Input: l1 = [0], l2 = [0]
Output: [0]
Example 3:
Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
Output: [8,9,9,9,0,0,0,1]
Constraints:
The number of nodes in each linked list is in the range [1, 100].
0 <= Node.val <= 9
It is guaranteed that the list represents a number that does not have leading zeros.
Level :-
Medium
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example 1:
Input: l1 = [2,4,3], l2 = [5,6,4]
Output: [7,0,8]
Explanation: 342 + 465 = 807.
Example 2:
Input: l1 = [0], l2 = [0]
Output: [0]
Example 3:
Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
Output: [8,9,9,9,0,0,0,1]
Constraints:
The number of nodes in each linked list is in the range [1, 100].
0 <= Node.val <= 9
It is guaranteed that the list represents a number that does not have leading zeros.
π1
Logic :- DIVIDE AND RULE
4. Median of Two Sorted Arrays
Level Hard
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
Example 1:
Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000
Explanation: merged array = [1,2,3] and median is 2.
Example 2:
Input: nums1 = [1,2], nums2 = [3,4]
Output: 2.50000
Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
Constraints:
nums1.length == m
nums2.length == n
0 <= m <= 1000
0 <= n <= 1000
1 <= m + n <= 2000
-106 <= nums1[i], nums2[i] <= 106
4. Median of Two Sorted Arrays
Level Hard
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
Example 1:
Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000
Explanation: merged array = [1,2,3] and median is 2.
Example 2:
Input: nums1 = [1,2], nums2 = [3,4]
Output: 2.50000
Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
Constraints:
nums1.length == m
nums2.length == n
0 <= m <= 1000
0 <= n <= 1000
1 <= m + n <= 2000
-106 <= nums1[i], nums2[i] <= 106
π1
HCL Tech is hiring for Developer
Role: Developer
Passout year: 2022 and before
Experience: Freshers
Location: Pune
Qualification: BE/ B.Tech
Salary: βΉ 4.5 Lakh per year
Apply Now:
https://www.hcltech.com/jobs/developer-5
Role: Developer
Passout year: 2022 and before
Experience: Freshers
Location: Pune
Qualification: BE/ B.Tech
Salary: βΉ 4.5 Lakh per year
Apply Now:
https://www.hcltech.com/jobs/developer-5
Hcltech
Developer | HCLTech
T&D SR.NET API WITH .NET.ASP
Java Hyd Team
HCL Tech is hiring for Developer Role: Developer Passout year: 2022 and before Experience: Freshers Location: Pune Qualification: BE/ B.Tech Salary: βΉ 4.5 Lakh per year Apply Now: https://www.hcltech.com/jobs/developer-5
Don't apply now there is a bug in form soon it will be fixed
Microsoft is hiring for Research Intern
Role: Research Intern
Passout year: 2023/2024/2025
Qualification: BE/B.Tech/ME/M.Tech/MCA/MSC
Salary: 60k - 70k per month
Location: Benguluru
Apply Now: https://careers.microsoft.com/us/en/job/1491041/
Role: Research Intern
Passout year: 2023/2024/2025
Qualification: BE/B.Tech/ME/M.Tech/MCA/MSC
Salary: 60k - 70k per month
Location: Benguluru
Apply Now: https://careers.microsoft.com/us/en/job/1491041/
The @Qualifier annotation in Spring is used to differentiate a bean among the same type of bean objects.
If we have more than one bean of the same type and want to wire only one of them then use the @Qualifier annotation along with @Autowired to specify which exact bean will be wired.
If we don't use this annotation in the given project then we get an error like:
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type
If we have more than one bean of the same type and want to wire only one of them then use the @Qualifier annotation along with @Autowired to specify which exact bean will be wired.
If we don't use this annotation in the given project then we get an error like:
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type
The @Required annotation applies to bean property setter methods and it indicates that the affected bean property must be populated in XML configuration file at configuration time. Otherwise, the container throws a BeanInitializationException exception
import org.springframework.context.annotation.*;
@Configuration
public class HelloWorldConfig {
@Bean
public HelloWorld helloWorld(){
return new HelloWorld();
}
}
@Configuration
public class HelloWorldConfig {
@Bean
public HelloWorld helloWorld(){
return new HelloWorld();
}
}