Posts

Showing posts from November, 2024

Classic Dijkstra II

Image
For this problem (and the #3342), all we need to do is apply classic Dijkstra, there is only one tiny adjustment for the "weight" based on the time, everything else is standard. Code is down below, cheers, ACC. Find Minimum Time to Reach Last Room I - LeetCode 3341. Find Minimum Time to Reach Last Room I Medium 46 12 Add to List Share There is a dungeon with  n x m  rooms arranged as a grid. You are given a 2D array  moveTime  of size  n x m , where  moveTime[i][j]  represents the  minimum  time in seconds when you can  start moving  to that room. You start from the room  (0, 0)  at time  t = 0  and can move to an  adjacent  room. Moving between adjacent rooms takes  exactly  one second. Return the  minimum  time to reach the room  (n - 1, m - 1) . Two rooms are  adjacent  if they share a common wall, either  horizontally  or  vertically .   Example 1: Input:   moveTime = [[0,4],[4,4]] Output:   6 Explanation: The minimum time required is 6 seconds. At time  t == 4 , move fro

Claude vs ChatGPT: A Coder's Perspective on LLM Performance II

Image
Well, Claude does it again. Even against the powerful GPT 4o with Canvas, there is no match compared with the kids from Anthropic. Problem was this one:  Total Characters in String After Transformations I - LeetCode 3335. Total Characters in String After Transformations I Medium 83 4 Add to List Share You are given a string  s  and an integer  t , representing the number of  transformations  to perform. In one  transformation , every character in  s  is replaced according to the following rules: If the character is  'z' , replace it with the string  "ab" . Otherwise, replace it with the  next  character in the alphabet. For example,  'a'  is replaced with  'b' ,  'b'  is replaced with  'c' , and so on. Return the  length  of the resulting string after  exactly   t  transformations. Since the answer may be very large, return it  modulo   10 9  + 7 .   Example 1: Input:   s = "abcyy", t = 2 Output:   7 Explanation: First Transfo