Skip to content

Commit 264c976

Browse files
Created using Colaboratory
1 parent d3e4f4b commit 264c976

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Copy_of_Recursion_Power_Sum.ipynb

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": [],
7+
"authorship_tag": "ABX9TyMl8rik+h9XWJS4IX6zWWGE",
8+
"include_colab_link": true
9+
},
10+
"kernelspec": {
11+
"name": "python3",
12+
"display_name": "Python 3"
13+
},
14+
"language_info": {
15+
"name": "python"
16+
}
17+
},
18+
"cells": [
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {
22+
"id": "view-in-github",
23+
"colab_type": "text"
24+
},
25+
"source": [
26+
"<a href=\"https://colab.research.google.com/github/Matinnorouzi2023/Leetcode-Python-interview/blob/main/Copy_of_Recursion_Power_Sum.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"source": [
32+
"# Question 2:\n",
33+
"\n",
34+
"**Power Sum -** Let’s define a peculiar type of array in which each element is either an integer or another peculiar array. Assume that a peculiar array is never empty. Write a function that will take a peculiar array as its input and find the sum of its elements. If an array is an element in the peculiar array you have to convert it to it’s equivalent value so that you can sum it with the other elements. Equivalent value of an array is the sum of its elements raised to the number which represents how far nested it is.\n",
35+
"\n",
36+
" For e.g. [2,3[4,1,2]] = 2+3+ (4+1+2)^2\n",
37+
"\n",
38+
"[1,2,[7,[3,4],2]] = 1 + 2 +( 7+(3+4)^3+2)^2"
39+
],
40+
"metadata": {
41+
"id": "uHOjP_znJ20G"
42+
}
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": null,
47+
"metadata": {
48+
"id": "rQ2SjVuuJhuU"
49+
},
50+
"outputs": [],
51+
"source": []
52+
}
53+
]
54+
}

0 commit comments

Comments
 (0)