Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя yashpandey73

Автор yashpandey73, история, 3 года назад, По-английски

Given a 3D NxNxN matrix, such that value of A[i][j][k] is defined as i * k * ( i + j +k ) 1 <= i,j,k <= N for ex= A[1][1][1] = 3, A[2][2][2] = 24

Given a number S. Determine the max value of N such that: Sum of all array elements doesn't exceed S. for N = 2 , summation of Mat = 84 for N = 3 , Summation of Mat = 720 ( you can check that ) 3 <= S <= 1e16 any solution with O(N^2) or better complexity ?

  • Проголосовать: нравится
  • -28
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +7 Проголосовать: не нравится

This is a fun problem. But first, please put the link to the problem so it's not from an ongoing contest.

I assume by the lack of a link that this was from an ongoing contest. Sad, it's a fun problem, but oh well.

»
3 года назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Nothing math heavy here. Take a look at "arithmetic series" in google. You can calculate sum of this matrix in constant time. It really is fun problem. Try it.

»
3 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

I request everyone not to post any solutions as this problem is from an ongoing hiring challenge!