今年我想陪着 30 天之 29

1304. Find N Unique Integers Sum up to Zero

Given an integer n, return any array containing n unique integers such that they add up to 0.

  • Example 1:
    IInput: n = 5
    Output: [-7,-1,1,3,4]
    Explanation: These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].

  • Example 2:
    Input: n = 3
    Output: [-1,0,1]

  • Example 3:
    Input: n = 1
    Output: [0]

var sumZero = function(n) {
    let result =[]
    if(n % 2 === 1) {
      result.push(0)
    }
    for(let i = 1; i <= n/2; i++) {
      result.push(i, -i)
    }
    return result
};

<<:  [Day 29] Banana in a box!在那糖衣的背後

>>:  OK集#29-白话文Excel-公式现形记

[Day22] NLP会用到的模型(五)-self-attention

一. self-attention的编码方式 昨天说明了注意力主要是要明确算出input与outpu...

授权和认证开发方法

这里提供了有关如何在这里应用程序中实施身份验证和授权的方法:,这些指南将涵盖以下一般要点: 身份验证...

Day 05 Decorator

Decorator(装饰器) 是 Python 中很好用的一个东西,只要 @ 一下就可以处理掉很多东...

食谱搜寻系统MySQL下载+测试

Mysql下载 因为网路上已经有很多下载教学了,icebear也是参考网路上下载的,所以在这里就不多...

[Day32] Hexo - 修改主题样式及一些问题排除

虽然 Hexo 要完成架设 Blog 仅仅是几秒钟的时间就完成,但是在细部调整时还是会遇到不少困难,...