Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods:
- updateSubrectangle(int row1, int col1, int row2, int col2, int newValue)
- Updates all values with newValue in the subrectangle whose upper left coordinate is (row1,col1) and bottom right coordinate is (row2,col2).
- getValue(int row, int col)
- Returns the current value of the coordinate (row,col) from the rectangle.
Spectra
- Nmap
1
nmap -Pn -sV 10.10.10.229
Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-“, “b” maps to “-…”, “c” maps to “-.-.”, and so on.
For convenience, the full table for the 26 letters of the English alphabet is given below:
1 [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]Now, given a list of words, each word can be written as a concatenation of the Morse code of each letter. For example, “cab” can be written as “-.-..–…”, (which is the concatenation “-.-.” + “.-“ + “-…”). We’ll call such a concatenation, the transformation of a word.
Return the number of different transformations among all words we have.
Example:
Input: words = [“gin”, “zen”, “gig”, “msg”]
Output: 2
Explanation:
The transformation of each word is:
1
2
3
4 "gin" -> "--...-."
"zen" -> "--...-."
"gig" -> "--...--."
"msg" -> "--...--."There are 2 different transformations, “–…-.” and “–…–.”.
Note:
1.The length of words will be at most 100.
2.Each words[i] will have length in range [1, 12].
3.words[i] will only consist of lowercase letters.
Jewels and Stones
You’re given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so “a” is considered a different type of stone from “A”.
Example 1:
Input: jewels = “aA”, stones = “aAAbbbb”
Output: 3Example 2:
Input: jewels = “z”, stones = “ZZ”
Output: 0
Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
1.Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
2.Output: 7 -> 0 -> 8
Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
1.Given nums = [2, 7, 11, 15], target = 9,
2.Because nums[0] + nums[1] = 2 + 7 = 9,
3.return [0, 1].