Basic Process and Possible Python Packages
Step 1. Get Data
Beautiful Soup - deals with HTML and XML
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋
times.
Note: The algorithm should run in linear time and in O(1) space.
Example 1:
1 | Input: [3,2,3] |
Example 2:
1 | Input: [1,1,1,3,3,2,2,2] |
Method:
Time Complexity:
Space Complexity:
1 | class Solution: |
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
1 | Input: |
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
1 | Input: head = [4,5,1,9], node = 5 |
1 | Input: head = [4,5,1,9], node = 1 |
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
1 | Given the sorted linked list: [-10,-3,0,5,9], |
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.
1 | Input: 1->2->3->4->5->NULL |
1 | Input: 2->1->3->5->6->4->7->NULL |
Rewrite the following statements in formal way:
All real numbers have nonnegative squares.
(Equivalent to Every Real number has a nonnegative square
)
$\forall X \in R, x^2 \geq 0$
All real numbers have squares not equal to -1.
(Equivalent to No real numbers have squares equal to -1
)
$\forall X \in R, X^2 \text{ \}= -1$
There is a positive integer whose square is equal to itself.
(Equivalent to Some positive integer equals its own square.
)
$\exist X \in Z^+ \text{ such that} X^2 = X$