Tuesday, March 20, 2018

H2O Wireless LTE Config Profile Download

TL;DR => type www.boltconfig.com in Safari with wifi connected.

I am using the H2O Wireless $30/Month Plan with Auto Recharge of only $27. I strongly recommend it which is affordable and fast, with 2GB rollover data.

Since iPhone hides the manual APN setting for ATT-MVNO (Mobile virtual network operator), I still tried to tweak it a bit. I deleted the original H2O-Locus profile and tried ATT-MVNO and H2OWireless(LTE) from http://unlockit.co.nz/. Both could only work under 4G, not LTE. When I wanted to get the H2O-Locus profile back, no way, I could not find it any more. I found this http://www.locusapi.com/pcs/apn.php (no use), but did not receive the config profile after login. Tried again, this time no one-time pwd received. Very confused.

Finally, I called the H2O specialist. She is very nice and sent the boltconfig link via message. I set it up very quickly and it seemed the right one. Even without thank her, the signal lost and reset. Yeah, it is LTE again.

BTW, here is one useful Chinese blog recommending H2O for your reference, https://www.blogus123.com/transfer-from-att-to-h2o/. And one more forum post for thoughts on H2O, https://kantie.org/topics/mitbbs/10307. Thank you for reading!

Wednesday, October 25, 2017

487. Max Consecutive Ones II

Problem:
Find the max length of consecutive ones with one flip (0 => 1)

Thinking process:
1. Naive method is to get all segments of 1s, at the same time keep this information: how many 0s are between two segments of 1s. Try to concatenate two segments with only one 0 between them. Update the max.
2. Cons: Many corner cases for this method (all 0s, all 1s, etc.). Two pass is proper, and O(N) space is needed. If with one pass, careful coding is needed with multiple if... else... statements.
3. If we want to know what is max length until current position, we are only interested in how many 0s we have encountered before. Since only one 0 is allowed. If we know the position of second last 0, things become clear.
4. Thus, keep a window [l, r] with at most one 0 in between. And the second last 0 is at position p = l - 1, so l = p + 1.

Follow up:
What if K (>=0) flips is allowed?
1. Then, we are interested in where the last K 0s are.
2. By using a queue to track the positions of previous 0s. If the size of queue is more than K, we need immediately remove the front of queue, let's say p, then l = p + 1.
3. In the code, I treat l as the previous slot of the window to get rid of +1 or -1.
4. Note that the queue technique can deal with input stream, if it is not a fixed vector.
5. But a long or long long or other big_integer is needed to track the ans, since it may be very large without MOD 1e9+7.

485. Max Consecutive Ones

First blog!
Let's start with this short interesting one.

Problem:
Find the max length of consecutive ones in a "01" vector.

Thinking process:
1. 0s divide 1s. So ++count of 1s while num == 1, reset it to 0 while num == 0. Update the ans to max each time.
2. To decrease comparison times: If 1s are more frequent than 0s, we can update ans whenever we meet a 0; but need one more update after traversing the vector.
3. On the contrary, If 0s are more frequent, update ans while num == 1.
4. Corner case: vector is empty => 0