Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website 😊
Still working on it 😊
Download Telegram
Photo from ENTREPRENEUR
Algorithm
Initialize sum←0,hashMap[0]←0,i←0sum \leftarrow 0, hashMap[0] \leftarrow 0, i \leftarrow 0sum←0,hashMap[0]←0,i←0.
sum+=nums[i]sum += nums[i]sum+=nums[i].
If hashMaphashMaphashMap does not contain key sum%ksum \% ksum%k (this remainder modulo kkk occurs for the first time) then hashMap[sum%k]←i+1hashMap[sum \% k] \leftarrow i + 1hashMap[sum%k]←i+1, go to 5.
If hashMap[sum%k]<ihashMap[sum \% k] < ihashMap[sum%k]<i (the subarray size is at least two) return true.
i+=1i += 1i+=1.
If i<nums.lengthi < nums.lengthi<nums.length go to 2.
Return false.
Given an integer array nums and an integer k, return true if nums has a continuous subarray of size at least two whose elements sum up to a multiple of k, or false otherwise.

An integer x is a multiple of k if there exists an integer n such that x = n * k. 0 is always a multiple of k.
Merge Two Sorted Lists
You are given the heads of two sorted linked lists list1 and list2.

Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists.

Return the head of the merged linked list.
Input: list1 = [1,2,4], list2 = [1,3,4]
Output: [1,1,2,3,4,4]
Example 2:

Input: list1 = [], list2 = []
Output: []
Example 3:

Input: list1 = [], list2 = [0]
Output: [0]


Constraints:

The number of nodes in both lists is in the range [0, 50].
-100 <= Node.val <= 100
Both list1 and list2 are sorted in non-decreasing order.
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode mergeTwoLists(ListNode list1, ListNode list2) {

}
}
😊😊