Categories
Easy Problems

โจทย์เขียนโปรแกรมข้อ VZ0066

จงเขียนฟังก์ชั่นที่รับค่า array ของ integer เข้าไปแล้ว แล้วส่งค่า array ของ integer ออกมาโดย มีสมาชิกแต่ละตัวเป็นค่าที่บวกกับสมาชิกที่ index เดียวกันใน array ตัวแรก แล้วได้ค่าเป็น 0

Examples
additiveInverse([5, -7, 8, 3]) ➞ [-5, 7, -8, -3]

additiveInverse([1, 1, 1, 1, 1]) ➞ [-1, -1, -1, -1, -1]

additiveInverse([-5, -25, 35]) ➞ [5, 25, -35]

เฉลย ด้วยภาษา Python

Leave a Reply