Skip to content

Commit 91de968

Browse files
committed
Modified
1 parent d9797ad commit 91de968

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

algorithms/array/boyer-moore-majority-vote-algorithm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## Description
55
To find the majority element from the sequence, majority means the element should be present more than n/2
6-
times the total length of the sequence.
6+
times the total length, n, of the sequence.
77

88
If the no such element occurs, then algorithm can return any arbitrary element, that is not guaranteed that this element
99
will be the mode or occurred maximum number of times.

codechef/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,4 @@
3434
| :---: | :--- | :--- |
3535
| 1. | [Counting Pretty Numbers](https://www.codechef.com/problems/NUM239) | [Python](https://github.com/ramanaditya/data-structure-and-algorithms/blob/master/codechef/easy/counting-pretty-numbers.py) |
3636
| 2. | [Processing a string](https://www.codechef.com/problems/KOL15A) | [Python](https://github.com/ramanaditya/data-structure-and-algorithms/blob/master/codechef/easy/processing-a-string.py/) |
37-
38-
![](../images/comp.jpeg)
37+

interview/networking.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Networking is interacting with others to exchange information and develop profes
1919
- Be appreciative
2020
- Note next steps
2121
- Medium Connections
22+
- Low Connections
23+
- Targeting Specific Employers: Reach out to the employees of your target companies.
24+
- How to Contact: Don't spam out for messages just for networking favour.
25+
- Following Up: Thank them for even their smallest help. Thank them when you get a job.
2226

2327

2428

leetcode/array/available-captures-for-rook.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''
1+
"""
22
## Question
33
### 999. [Available Captures for Rook](https://leetcode.com/problems/available-captures-for-rook/)
44
On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, and black pawns. These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase characters represent black pieces.
@@ -29,10 +29,11 @@
2929
- board.length == board[i].length == 8
3030
- board[i][j] is either 'R', '.', 'B', or 'p'
3131
- There is exactly one cell with board[i][j] == 'R'
32-
'''
32+
"""
3333

3434
## Solutions
3535

36+
3637
class Solution:
3738
def numRookCaptures(self, board: List[List[str]]) -> int:
3839
if not board:
@@ -48,38 +49,39 @@ def numRookCaptures(self, board: List[List[str]]) -> int:
4849
count = 0
4950
i -= 1
5051
while i >= 0:
51-
if board[i][n] == 'p':
52+
if board[i][n] == "p":
5253
count += 1
5354
break
54-
elif board[i][n] == 'B':
55+
elif board[i][n] == "B":
5556
break
5657
i -= 1
57-
i = m+1
58+
i = m + 1
5859
while i < len(board[0]):
59-
if board[i][n] == 'p':
60+
if board[i][n] == "p":
6061
count += 1
6162
break
62-
elif board[i][n] == 'B':
63+
elif board[i][n] == "B":
6364
break
6465
i += 1
6566
j -= 1
6667
while j >= 0:
67-
if board[m][j] == 'p':
68+
if board[m][j] == "p":
6869
count += 1
6970
break
70-
elif board[m][j] == 'B':
71+
elif board[m][j] == "B":
7172
break
7273
j -= 1
7374
j = n + 1
7475
while j < len(board):
75-
if board[m][j] == 'p':
76+
if board[m][j] == "p":
7677
count += 1
7778
break
78-
elif board[m][j] == 'B':
79+
elif board[m][j] == "B":
7980
break
8081
j += 1
81-
82+
8283
return count
8384

85+
8486
# Runtime: 36 ms
8587
# Memory Usage: 13.9 MB

0 commit comments

Comments
 (0)