Wednesday, November 3, 2021

Leetcode discuss: 37. Sudoku Solver | My practice and sharing

Nov. 3, 2021

Here is the link. 


C# | Depth first search | DFS with Backtracking - space efficiency | Warmup practice in 2021

Nov. 3, 2021
Introduction
It is so important for me to warm up my coding skills, and then I choose to write a C# solution to solve Sudoku solver 37.

Depth first search | Back tracking | Run a test case
The problem asked is to gurantee that there is a solution, so I choose to add a test case to run the code, and make sure that the code will return true if DFS is run to try to find first working solution.

I spent a few minutes to add the test case using given matrix in the problem statement.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _37_sudoku_solver
{
    class Program
    {
        static void Main(string[] args)
        {
            RunTestcase();
        }

        public static void RunTestcase()
        {
            var board = new char[9][];

            int index = 0;
            board[index++] = "53..7....".ToCharArray();
            board[index++] = "6..195...".ToCharArray();
            board[index++] = ".98....6.".ToCharArray();
            board[index++] = "8...6...3".ToCharArray();
            board[index++] = "4..8.3..1".ToCharArray();
            board[index++] = "7...2...6".ToCharArray();
            board[index++] = ".6....28.".ToCharArray();
            board[index++] = "...419..5".ToCharArray();
            board[index++] = "....8..79".ToCharArray();

            SolveSudoku(board);
        }

        /// <summary>
        /// warmup algorithm - need more practice to write C# code 
        /// board.length == 9
        /// board[i].length == 9
        /// board[i][j] is a digit or '.'.
        /// It is guaranteed that the input board has only one solution.
        /// </summary>
        /// <param name="board"></param>
        public static void SolveSudoku(char[][] board)
        {
            var result = RunDepthFirstSearch(board, 0, 0);
            //Debug.Assert(result);
        }

        /// <summary>
        /// classical DFS algorithm to work on
        /// </summary>
        /// <param name="board"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <returns></returns>
        private static bool RunDepthFirstSearch(char[][] board, int row, int col)
        {
            //base case
            if (row > 8)
            {
                return true; 
            }

            var isLastColumn = col == 8;
            int nextRow = isLastColumn ? (row + 1) : row;
            int nextCol = isLastColumn ? 0 : (col + 1);

            var current = board[row][col];
            bool isDot = current == '.';
            bool isNumber = (current - '0') >= 0 && (current - '0') <= 9;

            if (isNumber)
            {
                return RunDepthFirstSearch(board, nextRow, nextCol);
            }

            foreach (var digit in getAvailableDigits(board, row, col))
            {
                board[row][col] = digit;
                if(RunDepthFirstSearch(board, nextRow, nextCol))
                {
                    return true; 
                }

                board[row][col] = '.';
            }

            return false; 
        }

        /// <summary>
        /// Given a position in the matrix, check current row and current column, and also it's small matrix 3 x 3
        /// Idea is to remove existing chars from given string "123456789" which has all chars
        /// </summary>
        /// <param name="board"></param>
        /// <param name="currentRow"></param>
        /// <param name="currentCol"></param>
        /// <returns></returns>
        private static IEnumerable<char> getAvailableDigits(char[][] board, int currentRow, int currentCol)
        {
            var hashSet = new HashSet<char>("123456789".ToCharArray());

            for (int index = 0; index < 9; index++)
            {
                hashSet.Remove(board[currentRow][index]);
                hashSet.Remove(board[index][currentCol]);
            }

            // small 3 x 3 matrix - one of 9 3 x 3 matrixes
            var smallRow = currentRow / 3 * 3; // 0, 3, 6
            var smallCol = currentCol / 3 * 3; // 0, 3, 6
            
            for (int row = smallRow; row < smallRow + 3; row++)
            {
                for (int col = smallCol; col < smallCol + 3; col++)
                {
                    hashSet.Remove(board[row][col]);
                }
            }

            return hashSet; 
        }
    }
}

CVE stock: Q3 profit | My study

Cenovus reports $551M Q3 profit, doubles dividend and plans share buyback

 

CALGARY - 

Cenovus Energy Inc. doubled its dividend and announced a share buyback plan for up to 10 per cent of its shares as it reported a third-quarter profit of $551 million.

The company says it will now pay a quarterly dividend of 3.5 cents per share, up from 1.75 cents per share.

The increased payment to shareholders came as Cenovus reported its third-quarter profit amounted to 27 cents per share, compared with a loss of $194 million or 16 cents per share a year ago.

Revenue totalled $12.7 billion, up from nearly $3.7 in the same quarter last year.

The increase came as total upstream production rose to 804,800 barrels of oil equivalent per day compared with 471,799 a year ago.

Downstream throughput was 554,100 barrels per day, up from 191,100 in the same quarter last year.

This report by The Canadian Press was first published Nov. 3, 2021.

Tuesday, November 2, 2021

Car stock: over 100% gain in one day, $120 -> $500 -> $300

 



  • 1 hour ago
    When I shorted at $315 this morning, on the unexpected road to perdition, the margin requirements were 50%. Then, 30min later or so, the margin requirements increased to 240%. Then, 30min later the margin requirements were changed to 330%. Luckily, by then, the stock was back to $340. You can see how the broker has a strange of client protection and indeed, they will immediately liquidate after you are outside the margin requirements.
  • bpowers
    2 hours ago
    Sadly, when you short something you are subject to being called out. Others here who were called out near the top switched to their spouses account and shorted more. The problem is, when you're long the lowest a stock can go is zero, when you're short the sky is the limit. It was your broker's obligation to call you out as the stock soared. Without that, it's possible you'd have lost a lot more. It's just sad that your limit was so high; otherwise you might have got called out much sooner.

Monday, November 1, 2021

T-Mobile And Sprint CEOs John Legere And Marcelo Claure On Mega Merger | CNBC

Nov. 1, 2021

Here is the link.

T-Mobile CEO John Legere and Sprint CEO Marcelo Claure speak to "Squawk on the Street" about inking the $26 billion deal that could shake up the telecommunications sector. » Subscribe to CNBC: http://cnb.cx/SubscribeCNBC About CNBC: From 'Wall Street' to 'Main Street' to award winning original documentaries and Reality TV series, CNBC has you covered. Experience special sneak peeks of your favorite shows, exclusive video and more.

John Legere | T-mobile former CEO


John Legere (born June 4, 1958) is an American businessman, former chief executive officer (CEO) and president of T-Mobile US. He previously worked for AT&T, Dell, Global Crossing, and is on the CTIA board of directors. He resigned as CEO following the approval of the merger of T-Mobile and Sprint. 

Early life and education[edit]

A Massachusetts native, Legere graduated from St. Bernard's Central Catholic School in Fitchburg, Massachusetts and aspired to be a gym teacher, before he figured out he wanted a more lucrative career and decided to study business instead.[1] He received an Accounting BBA from the University of Massachusetts, an MS, as an Alfred P. Sloan fellow, at the MIT Sloan School of Management and an MBA from Fairleigh Dickinson University. He also completed Harvard Business School's Program for Management Development (PMD).[2][3]

Career[edit]

Legere was appointed CEO of T-Mobile US in September 2012, and has since been noted for T-Mobile's "Un-carrier" approach to contract-free wireless networks.[4]

He first worked in telecommunications at New England Telephone. Legere then spent nearly twenty years at AT&T, where he spent some time working under Daniel Hesse, formerly CEO of Sprint Corporation.[1] He served as chief executive for AT&T Asia from April 1994 to November 1997, and also spent time as head of AT&T Global Strategy and Business Development. From 1997 to 1998, he served as President of the worldwide outsourcing subsidiary of AT&T, AT&T Solutions.[5][2][6]

Legere then worked as senior vice president of Dell and president and chief operations officer for Dell's Operations in Europe, the Middle East and Africa and president, Asia-Pacific for Dell from 1998 to February 2000. Prior to joining T-Mobile US, he was CEO of Asia Global Crossing from February 2000 to January 2002, and CEO of Global Crossing from October 2001 to October 2011 where he led the organization through bankruptcy and eventually an acquisition by Level 3 Communications.[1][5] His leadership at Global Crossing was controversial, which included large executive bonuses and filing for bankruptcy.[7]

He serves on the CTIA board of directors,[8] and has been a director of the CTIA wireless internet caucus, since October 2012. He was a director of Global Crossing, from October 2001 to December 2003, and Sanrise Group and Asia Global Crossing, from April 2000 to March 2002. He was a director of ON Semiconductor.[5]

In November 2019, Legere announced via his Twitter account he would be stepping down as the CEO for T-Mobile US on April 30, 2020, when his current contract expires. Mike Sievert, who was chief operating officer at the time, was announced as Legere’s replacement. The change was originally planned to become effective on May 1, 2020.[9] Following the merger with Sprint being completed early, Legere officially resigned as CEO on April 1, 2020.[10]

Personal life[edit]

Legere was a nationally competitive runner in college and post-college and still competes in events with fellow employees. In 2004, he completed the Boston Marathon as a member of the Dana–Farber Cancer Institute Marathon Challenge team.[5] In May 2016 in support of competitive running, he purchased ad space on Nick Symmonds' shoulder for T-Mobile.[11]

He has been a member of the corporate advisory board of the School of Business and Management, Hong Kong University of Science and Technology, and the government relations committee of the American Chamber of Commerce, Hong Kong.[5]

Legere has been divorced twice and has two daughters.[12][13]

Since 2016, he has pitched his ideas and asked people to sign up for T-Mobile service with a cooking show on Facebook Live, called "Slow Cooker Sunday" which, as its name implies, runs every Sunday.[14] In 2018, he wrote a cookbook featuring recipes he used in slow cooker Sunday broadcasts titled "#SlowCookerSunday – Leadership, Life and Slow Cooking with CEO and Chef, John Legere". The book includes a foreword from Martha Stewart, a friend of Legere's. The proceeds of the book go to the charity Feeding America.[15]

T-mobile stock: John Legere interview | My 20 minutes research

Nov. 1, 2021

Here is the link. 

David Pogue interviews TMobile CEO John Legere about the company's latest announcement.

Watch CNBC's full interview with T-Mobile's new CEO, Mike Sievert

Nov. 1, 2021

Here is the link. CBBC television, Apr 1, 2020

T-mobile, Sprint merge

New network offers:

  • Average 5G speeds up to 8x faster than current LTE
  • 5G to 99% of U.S. within six years
  • 90% coverage to rural Americans with 5G speeds of 50 Mbps
T-mobile, sprint cross finish line, long-awaited merger closes today 

TMUS stock: T-Mobile customers | My 20 minutes study

 104.79 million customers

T-Mobile US: number of customers/subscribers 2018-2021, by quarter. In the second quarter of 2021, T-Mobile provided a service for over a total of 104.79 million customers.

T-Mobile Adds 5.5 Million Postpaid Customers in 2020 – the Most in Company History – and Further Expands 5G Network Leadership by Exceeding Ambitious 2020 5G Goals

Jan 06, 2021

America’s Largest 5G Network Now Brings Ultra Capacity 5G’s Game-Changing Speeds to 106 Million People and Reaches 280 Million People Nationwide

Preliminary Fourth Quarter 2020 Customer Results Expected to Lead the Industry Again

  • 1.7 million total net additions
  • 1.6 million postpaid net additions
  • 824,000 postpaid phone net additions

Preliminary Full-Year 2020 Customer Results Highlighted by Record-High Postpaid Net Additions

  • 5.6 million total net additions
  • 5.5 million postpaid net additions
  • 2.2 million postpaid phone net additions

Expanding 5G Network Leadership

  • Extended Range 5G covers 280 million people across nearly 1.6 million square miles, nearly 4x more than Verizon and over 2.5x more than AT&T
  • Ultra Capacity 5G covers 106 million people, over 50x more than Verizon's 5G Ultra Wideband, with nationwide coverage expected by the end of 2021

BELLEVUE, Wash.--(BUSINESS WIRE)-- T-Mobile US, Inc. (NASDAQ: TMUS) provided a preliminary view of key customer results for the fourth quarter and full-year 2020, including its highest postpaid net additions in company history at 5.5 million for the full-year 2020. In the fourth quarter, T-Mobile is expected to lead the industry again across several key metrics with 1.7 million total net additions, 1.6 million postpaid net additions, and 824,000 postpaid phone net additions.

T-Mobile further expanded its 5G network leadership, now reaching 280 million people and covering 106 million people with Ultra Capacity 5G’s super-fast speeds enabled by mid-band (2.5 GHz) and millimeter wave spectrum. The 106 million surpassed the company’s aggressive goal to cover 100 million Americans by the end of 2020 and compared to an estimated 2 million people covered by Verizon’s Ultra Wideband 5G, showcasing T-Mobile’s dramatic lead in the 5G race.

“Our focus on bringing unmatched value and experience to customers while building and delivering the nation’s best 5G network paid off with record-breaking results in 2020 (5.5 million new postpaid customers!) – and we continue to be the growth leader in wireless,” said Mike Sievert, T-Mobile CEO. “Our 5G leadership position is getting stronger every day. We set some huge goals in 2020 that some thought were impossible, but we smashed them. Today, T-Mobile’s high speed Ultra Capacity 5G covers over 50 times more people than Verizon and it’s growing. We continue to demonstrate that we are way ahead of the competition on 5G and poised to become the country's overall network leader. The network performance we’re delivering right here, right now, is setting the stage for what’s next. This is what leadership looks like!”

Preliminary Fourth Quarter and Full-Year 2020 Customer Results

  • Total net customer additions were 1.7 million in Q4 2020 and 5.6 million for the full-year 2020, the highest annual number in four years. The total customer count increased to a record-high of 102.1 million.
  • Postpaid net customer additions were 1.6 million in Q4 2020 and 5.5 million for the full-year 2020, the highest annual number in company history.
  • Postpaid phone net customer additions were 824,000 in Q4 2020 and 2.2 million for the full-year 2020. Postpaid phone churn was 1.03% in Q4 2020 and 0.90% for the full-year 2020.
  • Postpaid other net customer additions were 794,000 in Q4 2020 and 3.3 million for the full-year 2020, the highest annual number in company history.
  • Prepaid net customer additions were 84,000 in Q4 2020 and 145,000 for the full-year 2020. Prepaid churn was 2.92% in Q4 2020 and 3.03% for the full-year 2020.

Customer results for the fourth quarter and full-year 2020 are preliminary and subject to change pending completion of year-end closing review procedures. On April 1, 2020, T-Mobile completed its merger with Sprint. The following table reflects the combined company results of T-Mobile subsequent to the merger date for Q2 2020 through Q4 2020, while prior periods represent the historical results of standalone T-Mobile.


  1. In Q2 2020 T-Mobile acquired the customers of Sprint and made certain adjustments to align the customer reporting policies of T-Mobile and Sprint, resulting in the acquisition of 29,228,000 additional customers, net of base adjustments. Please reference the T-Mobile Quarterly Report for the quarterly period ended June 30, 2020, for a detailed reconciliation of the acquired customers and base adjustments.

Expanding 5G Network Leadership

T-Mobile is America’s 5G leader, delivering 5G speeds in more places with the first and largest nationwide 5G network. T-Mobile’s Extended Range 5G covers 280 million people across nearly 1.6 million square miles – offering nearly 4x more geographic coverage than Verizon and over 2.5x more than AT&T.

T-Mobile's Ultra Capacity 5G, which is enabled by mid-band (2.5 GHz) and millimeter wave spectrum, has been rapidly expanding and now covers 106 million people, over 50x more than Verizon's 5G Ultra Wideband. Ultra Capacity 5G is available in more than 1,000 cities and towns across the country including major markets such as Chicago, Houston, Los Angeles, New York City, Philadelphia, and Washington D.C. The performance of Ultra Capacity 5G is incredible, delivering download speeds in the 300 Mbps range and peak speeds hitting one Gbps on compatible 5G devices.

The company expects its Ultra Capacity 5G service to reach nationwide coverage by the end of 2021.


TMUS stock: Watch CNBC's full interview with T-Mobile's new CEO, Mike Sievert

Nov. 1, 2021

Here is the link. 

Mike Sievert, the new CEO of T-Mobile, joins "Squawk on the Street" to discuss the completion of the company's deal with Sprint.

37. Sudoku Solver: C# | DFS algorithm | 2018 practice | Warmup

Nov. 1, 2021

Here is the link. 

C# | DFS algorithm | 2018 practice | Warmup

Nov. 1, 2021
Introduction
It is the most important experience to learn how to write a perfect DFS algorithm by solving Sudoku algorithm. I also came cross this algorithm since my college classmate back in 1984 to 1988 worked on Sudoku algorithm on paper and wondered how it is designed.

DFS algorithm | Back tracking | Available digits to keep row, column, 3 x 3 matrixs unique numbers

It is kind of brute force solution. Go through all possible digits and then call the DFS function sudokuSolveHelper recursively.

Back tracking is also important to keep allow space efficient as well.

Performance | 15 minutes to write perfect code | Pramp 30 mock interview experience

I had 30 mock interviews experience to work on Sudoku with various engineers in Canada over 12 months. So many tips came in from my experience to work with talent engineers in the world. I learn how to write bug free code in less than 15 minutes and then the code should be able to run without any debugging.

The following code passes online judge.

public class Solution {
    public void SolveSudoku(char[][] board) {
        sudokuSolveHelper(board, 0, 0);
    }      
    
    private static bool sudokuSolveHelper(char[][] board, int row, int col)
        {
            // base case 
            if (row > 8)  
            {
                return true;
            }
        
            var isLastColumn = col == 8;
            int nextRow = isLastColumn ? (row + 1) : row;
            int nextCol = isLastColumn ? 0 : col + 1;

            var  current = board[row][col];
            bool isDot = current == '.';
            bool isNumber = (current - '0') >= 0 & (current - '0') <= 9;
            if (isNumber)  
            {                
                return sudokuSolveHelper(board, nextRow, nextCol);  
            }
           
            foreach (var digit in getAvaiableDigits(board, row, col))
            {
                board[row][col] = digit; 

                if (sudokuSolveHelper(board, nextRow, nextCol))
                {
                    return true;
                }

                board[row][col] = '.';
            }            

            return false;
        }

        private static IEnumerable<char> getAvaiableDigits(char[][] board, int currentRow, int currentCol)
        {
            var hashSet = new HashSet<char>("123456789".ToCharArray());

            for (int index = 0; index < 9; index++)
            {
                // remove current row used char
                hashSet.Remove(board[currentRow][index]);
                hashSet.Remove(board[index][currentCol]);
            }

            // small 3 x 3 matrix 
            var smallRow = currentRow / 3 * 3; // 0, 3, 6
            var smallCol = currentCol / 3 * 3; // 0, 3, 6
            for (int row = smallRow; row < smallRow + 3; row++)
            {
                for (int col = smallCol; col < smallCol + 3; col++)
                {
                    hashSet.Remove(board[row][col]);
                }
            }

            return hashSet;
        }   
}

Comments: 0

福布斯:美国最大的生物科技公司TOP10 | 2015 Nov 19

 生物科技公司在制药业虽然占比不大,却也是一颗冉冉升起的新星。福布斯网公布了美国最大的十家生物科技公司。其中,吉利德科学公司以1543亿美元的市值排名第一。吉利德科学公司开发和销售的药物广泛应用在治疗病菌传染方面,包括病毒传染、真菌感染和细菌传染。另外榜单还列出了各公司过去12个月的净销售额以及过去5年的平均销售增幅。吉利德科学公司在过去12个月净销售额最高,达207亿美元。排名第7位的顶尖制药公司5年平均销售增幅最大,高达77.4%。

1. 吉利德科学(Gilead Sciences)
    市值:1543亿美元
    过去12个月净销售额:207亿美元
    5年平均销售增幅:14.6%

2. 安进(Amgen)
    市值:1199亿美元
    过去12个月净销售额:197亿美元
    5年平均销售增幅:4.7%

3. 新基医药(Celgene Corporation)
    
市值:919亿美元
    过去12个月净销售额:73亿美元
    5年平均销售增幅:24.4%

4. 百健艾迪(BiogenIdec)
    市值:827亿美元
    过去12个月净销售额:90亿美元
    5年平均销售增幅:10.1%

5. 再生元制药公司(Regeneron Pharmaceuticals)
    
市值:402亿美元
    过去12个月净销售额:26亿美元
    5年平均销售增幅:52.3%

6. 亚力兄制药公司(Alexion Pharmaceuticals)
    
市值:364亿美元
    过去12个月净销售额:21亿美元
    5年平均销售增幅:43%

7. 顶点制药(Vertex Pharmaceuticals)
    市值:298亿美元
    过去12个月净销售额:7.87亿美元
    5年平均销售增幅:77.4%

8. 亿明达(Illumina)
    
市值:279亿美元
    过去12个月净销售额:17亿美元
    5年平均销售增幅:19.8%

9. 马林制药(BioMarin Pharmaceutical)
    
市值:139亿美元
    过去12个月净销售额:6.678亿美元
    5年平均销售增幅:13.8%

10. 安捷伦科技(Agilent Technologies)
    市值:137亿美元
    过去12个月净销售额:70亿美元
    5年平均销售增幅:8.7%

《福布斯:美国最大的生物科技公司TOP10》原文地址

Breakfast and learn: How to architect a collaborative big data platform (Google Cloud Next '17)

Nov. 1, 2021

Here is the link. 

Collaboration on big data can take place with effective storing, cataloging, and fronting of data sources with robust APIs so that developers can quickly build applications using multiple data sources without worrying about storage mediums or permissions. In this video, Sandeep Parikh shows you how to architect a collaborative data platform inside of Google Cloud Platform (GCP) and how to map it to the prototypical data lifecycle. Missed the conference? Watch all the talks here: https://goo.gl/c1Vs3h Watch more talks about Big Data & Machine Learning here: https://goo.gl/OcqI9kf