We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Bill Division
- Discussions
Bill Division
Bill Division
Sort by
recency
|
1733 Discussions
|
Please Login in order to post a comment
C++ CODE
using two pointers, instead of iterating over all the elements to calculate the sum: O(n), you can improve that to O(n/2)
half the number of steps to complete the opertaion:
C# code: public static void Optimal(List bill, int k, int b) { var leftPointer = 0; var rightPointer = bill.Count - 1; var totalBill = 0;
}
python3
C++