Day IDK - #4841
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new Day 48–51 DSA/LeetCode Java solutions under DSA/RaghavSinghal_590012854, continuing the daily practice structure in this repo.
Changes:
- Day 48: add solutions for “sort the students” (LeetCode) and a reconstruction problem.
- Day 50: add solutions for a LeetCode “final state after k operations” problem and “last rock weight”.
- Day 51: add a receiving-log validation solution.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| DSA/RaghavSinghal_590012854/Day_51/Question2.java | Adds receiving-log validation; currently contains duplicated code causing compile failure. |
| DSA/RaghavSinghal_590012854/Day_51/Problem1_Leetcode.java | Adds “most frequent even” LeetCode solution. |
| DSA/RaghavSinghal_590012854/Day_50/Question2.java | Adds max-heap solution for “last rock weight”. |
| DSA/RaghavSinghal_590012854/Day_50/Problem1_Leetcode.java | Adds heap-based “final state” solution; current logic does not preserve original indices/order. |
| DSA/RaghavSinghal_590012854/Day_48/Question2.java | Adds array reconstruction solution and a small demo main. |
| DSA/RaghavSinghal_590012854/Day_48/Problem1_Leetcode.java | Adds Arrays.sort-based solution for sorting students by column k. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+25
to
+49
| }import java.util.*; | ||
|
|
||
| public class Main { | ||
| public static int validateReceivingLog(String[][] records) { | ||
| Map<String, String> seen = new HashMap<>(); | ||
|
|
||
| for (int i = 0; i < records.length; i++) { | ||
| String vendorId = records[i][0]; | ||
| String lotNumber = records[i][1]; | ||
| String certCode = records[i][2]; | ||
|
|
||
| String key = vendorId + "\u0000" + lotNumber; | ||
|
|
||
| if (seen.containsKey(key)) { | ||
| if (!seen.get(key).equals(certCode)) { | ||
| return i; | ||
| } | ||
| } else { | ||
| seen.put(key, certCode); | ||
| } | ||
| } | ||
|
|
||
| return -1; | ||
| } | ||
| } No newline at end of file |
Comment on lines
+3
to
+23
| class Solution { | ||
| public int[] getFinalState(int[] nums, int k, int multiplier) { | ||
| PriorityQueue<Integer> pq = new PriorityQueue<>(); | ||
|
|
||
| for (int num : nums) { | ||
| pq.offer(num); | ||
| } | ||
|
|
||
| while (k-- > 0) { | ||
| int min = pq.poll(); | ||
| min *= multiplier; | ||
| pq.offer(min); | ||
| } | ||
|
|
||
| for (int i = 0; i < nums.length; i++) { | ||
| nums[i] = pq.poll(); | ||
| } | ||
|
|
||
| return nums; | ||
| } | ||
| } No newline at end of file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.