Open In App

Contest Experiences | LeetCode: #Weekly Contest 328

Last Updated : 16 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

About the Contest: LeetCode #Weekly Contest 328

This was a contest organized on the LeetCode platform on January 15th, 2023 (Sunday) and it consisted of 4 questions that were to be solved in a time frame of 90 minutes from 08:00 AM to 09:30 AM.

  • Question-wise point values: 3-4-5-6.
  • The penalty time of 5 minutes will be applied for each wrong submission.

Prizes/Offers:

  • Ranked 1st will win an Apple HomePod mini
  • Ranked 2nd will win a Logitech G903 LIGHTSPEED Gaming Mouse
  • Ranked 3rd to 5th will win a LeetCode Backpack
  • Ranked 6th to 10th will win a LeetCode water bottle
  • Also, there were awards such as 5 LeetCode Coins for all the participants and more coins for top rankers.

NOTE: LeetCode Coins are Special coins which can be redeemed in LeetCode store to buy available swags.

Link of the contest: https://leetcode.com/contest/weekly-contest-328/

Overview of the Challenge:

Problem Name

Points/Scores

Difficulty Level

Pre-Requisites

Time to Solve

Difference Between Element Sum and Digit Sum of an Array

3

Easy

Maths and arrays

2 min

Increment Submatrices by One

4

Medium

Matrix and Prefix Sum

15 min

Count the Number of Good Subarrays

5

Medium

HashMap and Sliding Window

25 min

Difference Between Maximum and Minimum Price Sum

6

Hard

DFS

unable to solve

Problem 1: Difference Between Element Sum and Digit Sum of an Array

It was a very simple question, where you need to simply traverse the array and get the sum of all the elements of the array and also get the sum of all the digits of all the elements of the array and finally return the absolute value of the difference between these two sums.

Problem 2: Increment Submatrices by One

  • Required knowledge of prefix sums and matrices
  • In Java, a brute-force solution involving simple traversal and addition of 1 is sufficient
  • Utilized the concept of prefix sum in the matrix
  • Kept track of rows and columns that were visited
  • Implemented a final traversal to accumulate the previous value
  • This approach provided the correct matrix as the answer

Problem 3: Count the Number of Good Subarrays

It was a well designed and a good level question according to me, it took some amount of times and after getting some WA, it got accepted. I used a hashmap to store the count frequency of the elements occurring in the array and the used the sliding window concept to move the window whenever there is a good pairs after adding it to my answer. If the k value goes lesser than or equals to 0 , simply added it to answer and removed the count from the hashmap by moving forward pointer of the window.

Problem 4: Difference Between Maximum and Minimum Price Sum

  • Initially found the question challenging during the contest.
  • Limited time and misunderstanding of the problem.
  • After the contest, revisited and successfully solved it.
  • Applied the concept of DFS (Depth-First Search) and utilized tree-like structures.
  • Unique characteristics of the problem: dealing with positive values, not a binary tree, and finding the path that subtracts the smaller endpoint.
  • Constructed an adjacency list to efficiently store the given values.
  • Implemented a DFS function with the logic of maximizing results from adjacent nodes.
  • The solution involved returning the maximum value obtained.

Conclusion:

  • Overall, I would rate this contest on a Medium-Hard side as there were questions from Sliding windows and also DFS(Graphs).
  • If your goal is to crack placement then this platform is for you. It have all the questions and discuss sections that are goldmine for placement preparation.
  • I would ask everyone to try this platform once, surely you all would get very comfortable with it.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads