Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

Sunday common C++ interview problem: Maximum subsequence dot product. Given two arrays of integers, determine the maximum dot product of subsequences formed from these arrays. The subsequences must have the same length and be non-empty but do not have to be formed from consecutive elements. Solve it yourself: https://lnkd.in/dt7rPdqQ Solution: https://lnkd.in/dqNENPU8 #cpp #cplusplus #coding #programming #dailybiteofcpp

  • diagram

Sorting both before multiply 🤔

Like
Reply

In your assert on : assert(max_dot_product({3,0,1},{1,3}) == 9); however is not clear from the condition. Why do you expect 9?

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories