O(1) one line solution || Explained
For all n belongs to Integer. \nRquired array is 1,3,5,...2n-1\nWe need to make all the elements equal to n.\nThe 1st and last element can be made equal to n in
For all n belongs to Integer. \nRquired array is 1,3,5,...2n-1\nWe need to make all the elements equal to n.\nThe 1st and last element can be made equal to n in (n-1) operations\nSimilarly, we require (n-1), (n-3), (n-5).... operations.\nTotal operations = (n-1)+(n-3)+(n-5)+... upto n/2 terms.\nIt can be simplified as (n+n+n....) - (1+3+5....)\nwhich equals n.n/2 - (n/2)^2\n= n^2/4\n```\nreturn (n*n)/4
['Math', 'C', 'Java']