Maximum number of characters using keystrokes A, Ctrl+A, Ctrl+C and Ctrl+V

前端 未结 14 1503
忘掉有多难
忘掉有多难 2020-12-07 07:03

This is an interview question from google. I am not able to solve it by myself. Can somebody shed some light?

Write a program to print the sequence of keystrokes suc

14条回答
  •  半阙折子戏
    2020-12-07 07:26

    Using the tricks mentioned in answers above, Mathematically, Solution can be explained in one equation as,

    4 + 4^[(N-4)/5] + ((N-4)%5)*4^[(N-4)/5]. where [] is greatest integer factor

提交回复
热议问题