CDChetan Dattainchetan77.hashnode.dev·Jun 7 · 2 min readFractional KnapsackProblem Given two arrays, val[] and wt[] , representing the values and weights of items, and an integer capacity representing the maximum weight a knapsack can hold, determine the maximum total value 00
CDChetan Dattainchetan77.hashnode.dev·Jan 17 · 3 min readMaximum XOR With an Element From ArrayProblem You are given an array nums consisting of non-negative integers. You are also given a queries array, where queries[i] = [x<sub>i</sub>, m<sub>i</sub>]. (link) The answer to the i<sup>th</sup> query is the maximum bitwise XOR value of x<sub>i<...00
CDChetan Dattainchetan77.hashnode.dev·Jan 15 · 2 min readMaximum XOR of Two Numbers in an ArrayProblem Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n. (link) Example 1: Input: nums = [3,10,5,25,2,8] Output: 28 Explanation: The maximum result is 5 XOR 25 = 28. Example 2: Input: nums = [14,7...00
CDChetan Dattainchetan77.hashnode.dev·Jan 15 · 2 min readCount of distinct substringsProblem Given a string s consisting of lowercase English characters, determine the total number of distinct non-empty substrings present in the string. A substring is defined as a contiguous block of characters within the string. Two substrings are c...00
CDChetan Dattainchetan77.hashnode.dev·Jan 15 · 2 min readLongest Valid Word with All PrefixesProblem Given an array of strings words[], find the longest string such that every prefix of it is also present in words[]. If multiple strings have the same maximum length, return the lexicographically smallest one. (link) If no such string is found...00