Replacing Array Item
input
output
input1
[1,2,3,"four",5,6]
"four"
4
output1
[1,2,3,4,5,6]
input2
[22,44,88,352,352]
352
176
output2
[22,44,88,176,352]
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
////
/////
function main() {
let myArray = JSON.parse(readLine().replace(/'/g, '"'));
let targetItem = JSON.parse(readLine().replace(/'/g, '"'));
let replaceItem = JSON.parse(readLine().replace(/'/g, '"'));
Write your code here and log the output
}
// quotient.cpp
// Author: Mr jake R. pomperada, BSCS, MAED- IT
// Date: august 14, 2018 Tuesday
// Location: Bacolod City, Negros occidental
// Website: http://www.jakerpompereda.com
Date format 2
Input
200
Output
3 minutes 20 seconds
Question 7
X = np.array([
[10,20,30],
[40,50,60],
[70,80,90]])
Answer:
print(X)
array([20, 50, 50])
Question 8
Y = np.array([
[3,6,9,12],
[15,18,21,24],
[27,30,33,36],
[39,42,45,48],
[51,54,57,60]])
Answer:
Question 8 Output
array([[ 3, 12],
[27, 36],
[51, 60]])
Question 9
print("Original array:")
Answer:
print(x)
>>>array([ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
print(“Remove even numbers from the array x: “)
Answer:
print(x)
>>>array([12, 14, 16, 18, 200])
print(“Replace all odd numbers in array x with -10:”)
Answer:
print(x)
>>> array([ 12, -10, 14, -10, 16, -10, 18, -10, 20])
Question 10
print("Original array:")
Answer:
>>> print(X)
[10 12 14 16 18 20 22 24 26 28 30]
>>> print(Z)
[10 12 14 16 18 20 22 24 26 28 30]
Answer:
>>> print(X)
[0 2 4 6 18 20 22 24 26 28 30]
Answer:
>>> print(Z)
[10,12,14,16,-18,-20,-22,-24,26,28,30]
Question 4
Answer:
Question 4 Output
array([8 10 12 14 16 18 20])
Question 5
print("Original array:")
Answer:
print(x)
>>>[12 13 14 15 16 17 18 19]
print("Reverse array:")
Answer:
>>>array([19, 18, 17, 16, 15, 14, 13, 12])
Question 6
x = [11, 12, 13]
print("Original array:")
print(x)
Answer:
print("After append values to the end of the array:")
print(x)
Question 6 Output
Original array:
[11,12,13]
After append values to the end of the array:
[21 22 23 24 31 32 33 34]
Question 1
a = np.array([[11,22,34],
[48,56,60]])
b = np.array([[18,69,87],
[52,26,35]])
Answer:
Question 1 Output:
array([[29,91,121],
[100,82,95]])
Question 2
a = np.array([[8,9,10],
[25,35,58]])
Answer:
Question 2 Output
array([[24,27,30],
[75,105,174]])
Question 3
x = np.zeros(10)
print(x)
print("Update eighth value to 11")
Answer:
print(x)
Question 3 Output
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
Update fifth value to 66 and eighth value to 45
[0. 0. 0. 0. 0. 66. 0. 0. 45. 0.]
Area of Largest Rectangle in Histogram
Input
215623
Roman numerals
Input
2
Palindrome Pairs
Sample input
Was it car or a cat i saw
Closest palindrome number
Sample input
19
Sample output
22