Merge pull request #138 from madeirak/master
modification of question No.74
This commit is contained in:
commit
93bb2f70a2
@ -1101,7 +1101,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### 74. Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)"
|
||||
"#### 74. Given a sorted array C that corresponds to a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1476,7 +1476,25 @@
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ np.sqrt(-1) == np.emath.sqrt(-1)
|
||||
|
||||
#### 73. Consider a set of 10 triplets describing 10 triangles (with shared vertices), find the set of unique line segments composing all the triangles (★★★)
|
||||
|
||||
#### 74. Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
#### 74. Given a sorted array C that corresponds to a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
|
||||
#### 75. How to compute averages using a sliding window over an array? (★★★)
|
||||
|
||||
|
@ -194,7 +194,7 @@ np.sqrt(-1) == np.emath.sqrt(-1)
|
||||
`hint: array[[]] = array[[]]`
|
||||
#### 73. Consider a set of 10 triplets describing 10 triangles (with shared vertices), find the set of unique line segments composing all the triangles (★★★)
|
||||
`hint: repeat, np.roll, np.sort, view, np.unique`
|
||||
#### 74. Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
#### 74. Given a sorted array C that corresponds to a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
`hint: np.repeat`
|
||||
#### 75. How to compute averages using a sliding window over an array? (★★★)
|
||||
`hint: np.cumsum`
|
||||
|
@ -778,7 +778,7 @@ G = F.view( dtype=[('p0',F.dtype),('p1',F.dtype)] )
|
||||
G = np.unique(G)
|
||||
print(G)
|
||||
```
|
||||
#### 74. Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
#### 74. Given a sorted array C that corresponds to a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
|
||||
|
||||
```python
|
||||
|
@ -49,7 +49,25 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ G = np.unique(G)
|
||||
print(G)
|
||||
|
||||
< q74
|
||||
Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
Given a sorted array C that corresponds to a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
|
||||
|
||||
< h74
|
||||
hint: np.repeat
|
||||
|
Loading…
Reference in New Issue
Block a user