Posts

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

Image
In the rapidly evolving world of Large Language Models (LLMs), recent releases from OpenAI's ChatGPT have garnered significant attention. However, when it comes to coding tasks, Anthropic's Claude.ai continues to impress me with its speed and quality of output. Benchmarking with LeetCode While LeetCode problems aren't the definitive measure of an AI's coding capabilities (they're pre-designed puzzles, after all), they offer an interesting playground for comparison. Let's dive into a recent example: The Problem K-th Largest Perfect Subtree Size in Binary Tree - LeetCode 3319. K-th Largest Perfect Subtree Size in Binary Tree Medium 36 6 Add to List Share You are given the  root  of a  binary tree  and an integer  k . Return an integer denoting the size of the  k th   largest   perfect binary   subtree , or  -1  if it doesn't exist. A  perfect binary tree  is a tree where all leaves are on the same level, and every parent has two children.   Example 1: Input:  

Sometimes it is OK to try all permutations II

Image
This one in particular only requires 3! permutations (also known as 6), the solution however is more generic for any number, although still an N! solution. Used Claude to help me refresh how to go from BigInteger to binary and vice-versa. Cheers, ACC Maximum Possible Number by Binary Concatenation - LeetCode 3309. Maximum Possible Number by Binary Concatenation Medium 51 3 Add to List Share You are given an array of integers  nums  of size 3. Return the  maximum  possible number whose  binary representation  can be formed by  concatenating  the  binary representation  of  all  elements in  nums  in some order. Note  that the binary representation of any number  does not  contain leading zeros.   Example 1: Input:   nums = [1,2,3] Output:  30 Explanation: Concatenate the numbers in the order  [3, 1, 2]  to get the result  "11110" , which is the binary representation of 30. Example 2: Input:   nums = [2,8,16] Output:  1296 Explanation: Concatenate the numbers in the order  [2,