Skip to content

奇数求和 ​

Code ​

ts
/**
 * 求从 1 开始的前 n 个奇数和
 */
function sum(n) {}

解析 ​

ts
function sum(n) {
  return n * n
}