Sort by

recency

|

2426 Discussions

|

  • + 0 comments

    Here is Electronics shop problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-electronics-shop-problem-solution.html

  • + 0 comments

    Guys relax O(m.n) is acceptable by editor. Don't over engineer

  • + 0 comments

    we can use binary search for the second array. lets assume that n > m then meaning, we would need to sort 2 arrays (O(nlogn)+O(mlogm) => 2O(nlogn))

    then on each iteration of the keyboards we will do another log(n) operation

    ===> 2O(nlogn) + nlogn time, and O(1) space

    def findMaxValue(arr, value) -> int: low,high= 0,(len(arr) - 1) while low <= high: mid = (low + high) // 2 if arr[mid] == value: return value elif arr[mid] > value: high = mid - 1 else: low = mid + 1 return None if arr[high] > value else arr[high]

    maxValue = -1
    keyboards.sort()
    drives.sort()
    for keyboard in keyboards:
        if keyboard >= b:   
            continue
        maxDrive = findMaxValue(drives, b - keyboard)
        if maxDrive:
            maxValue = max(maxValue, keyboard + maxDrive)    
    
    return maxValue
    
  • + 0 comments

    I was recently trying to buy a keyboard and a USB drive within my budget, but after going through the options, I realized I couldn’t make a choice that stayed within the limit. It’s kind of like when I was shopping for vapes online. I found so many premium options, but nothing that fit my needs within the budget. Then, I came across Standard CBD, where I could shop premium vapes, edibles, and CBD, all delivered fast to my door. It’s always about finding the best deal and enjoying wellness with every order, just like in this budget dilemma!

  • + 0 comments

    I run a car dealership shop in Arizona that sells new and used cars. I want to apply this code on my website, similar to how services like interior painting Edmonton manage their online tools. I want to use this code on my Magento-based website built with Magento 2.1 version.