chetan77.hashnode.devMaximum 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<...Jan 17·3 min read
chetan77.hashnode.devMaximum 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...Jan 15·2 min read
chetan77.hashnode.devCount 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...Jan 15·2 min read
chetan77.hashnode.devLongest 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...Jan 15·2 min read
chetan77.hashnode.devImplement Trie llProblem Ninja has to implement a data structure ”TRIE” from scratch. Ninja has to complete some functions. 1) Trie(): Ninja has to initialize the object of this “TRIE” data structure. 2) insert(“WORD”): Ninja has to insert the string “WORD” into th...Jan 11·3 min read