<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Huy Bui on Medium]]></title>
        <description><![CDATA[Stories by Huy Bui on Medium]]></description>
        <link>https://medium.com/@williamhuybui?source=rss-1369614bb5e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yhYsNwN2ser1iKZ5KCvGoA.png</url>
            <title>Stories by Huy Bui on Medium</title>
            <link>https://medium.com/@williamhuybui?source=rss-1369614bb5e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 08:47:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@williamhuybui/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Vì Sao Software Engineer và Data Scientist Vẫn Cần Đọc Sâu Trong Thời Đại AI?]]></title>
            <link>https://medium.com/@williamhuybui/v%C3%AC-sao-software-engineer-v%C3%A0-data-scientist-v%E1%BA%ABn-c%E1%BA%A7n-%C4%91%E1%BB%8Dc-s%C3%A2u-trong-th%E1%BB%9Di-%C4%91%E1%BA%A1i-ai-28c067028efe?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/28c067028efe</guid>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Thu, 05 Nov 2026 02:38:11 GMT</pubDate>
            <atom:updated>2026-11-05T02:38:11.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKJEQsyfH3za_Jb_5Va1LQ.png" /></figure><p>Trong thời đại AI, việc tiếp cận kiến thức chưa bao giờ dễ dàng đến thế. Chỉ với vài câu prompt, chúng ta có thể viết code, tìm hiểu một thuật toán phức tạp, hoặc yêu cầu AI giải thích và tóm tắt hàng chục trang tài liệu chỉ trong vài giây.</p><p>Điều này đặt ra một câu hỏi: <strong>Khi AI đã có thể giải thích gần như mọi thứ, liệu chúng ta có còn cần dành hàng giờ để tự đọc và nghiên cứu những tài liệu chuyên sâu?</strong></p><p>Theo mình, câu trả lời là có, và việc này thậm chí còn quan trọng hơn trước.</p><p>Bởi vì <strong>có được câu trả lời và thực sự hiểu một vấn đề là hai chuyện hoàn toàn khác nhau.</strong></p><p>Một nghiên cứu của Bastani và cộng sự (2025), được công bố trên <em>Proceedings of the National Academy of Sciences (PNAS)</em>, đã chỉ ra một kết quả đáng suy nghĩ.</p><p>Trong một thí nghiệm với gần 1.000 học sinh trung học học toán, nhóm sử dụng GPT-4 đạt kết quả tốt hơn đáng kể khi giải bài tập với sự hỗ trợ của AI. Tuy nhiên, khi không còn được sử dụng AI trong bài kiểm tra, nhóm sử dụng GPT thông thường lại có điểm thấp hơn khoảng <strong>17% so với nhóm không được sử dụng AI</strong>.</p><p>Đáng chú ý, tác động tiêu cực này phần lớn được hạn chế khi AI được thiết kế để đưa ra gợi ý thay vì trực tiếp cung cấp đáp án.</p><p>Mặc dù nghiên cứu được thực hiện trong môi trường giáo dục, kết quả này khiến mình suy nghĩ về cách chúng ta sử dụng AI trong công việc hằng ngày.</p><p><strong>Liệu chúng ta đang sử dụng AI để nâng cao năng lực bản thân, hay chỉ để hoàn thành công việc nhanh hơn?</strong></p><p>Đó cũng là lý do mình nghĩ Software Engineer và Data Scientist nên duy trì thói quen đọc sâu những tài liệu có nội dung chuyên môn, cấu trúc chặt chẽ và đòi hỏi sự tập trung, chẳng hạn như research paper, sách chuyên ngành hoặc technical documentation.</p><p>Dưới đây là bốn lý do.</p><h3>1. Hiểu bản chất thay vì chỉ biết cách sử dụng</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-6UoZnwmycNTW0WfY4K7Q.png" /></figure><p>Phần lớn blog, tutorial hay video hướng dẫn thường tập trung vào việc một công nghệ hoạt động như thế nào và cách áp dụng nó vào thực tế.</p><p>Trong khi đó, những tài liệu chuyên sâu thường đi xa hơn: Vấn đề ban đầu là gì? Tại sao phương pháp này được lựa chọn? Những giả định nào được đưa ra? Và phương pháp đó phải đánh đổi những gì (trade-offs)?</p><p>Ví dụ, khi đọc <em>Attention Is All You Need</em> (Vaswani et al., 2017), chúng ta không chỉ biết Transformer sử dụng self-attention, mà còn có thể tìm hiểu vì sao kiến trúc này được đề xuất, nó giải quyết những hạn chế nào của các kiến trúc trước đó, và tại sao khả năng xử lý song song lại quan trọng.</p><p>Đối với Software Engineer, hiểu bản chất giúp chúng ta đưa ra quyết định tốt hơn khi thiết kế hệ thống, tối ưu performance hoặc debug những vấn đề phức tạp.</p><p>Đối với Data Scientist, nó giúp chúng ta hiểu các giả định toán học, giới hạn của mô hình, và tại sao một phương pháp có thể hoạt động tốt trên dataset này nhưng thất bại trên dataset khác.</p><p>Điều này cũng có cơ sở từ các nghiên cứu về khoa học nhận thức.</p><p>Trong nghiên cứu <em>Eliciting Self-Explanations Improves Understanding</em> (Chi et al., 1994), những học sinh được yêu cầu tự giải thích nội dung khi đọc tài liệu khoa học đã cải thiện mức độ hiểu biết nhiều hơn nhóm chỉ đọc tài liệu.</p><p>Kết quả này cho thấy việc chủ động giải thích giúp người học kết nối thông tin mới với những kiến thức đã có, thay vì chỉ tiếp nhận nội dung một cách thụ động.</p><p>Điều mình muốn nhấn mạnh ở đây là <strong>quá trình tự tìm hiểu, kết nối các ý tưởng và giải thích lại bằng ngôn ngữ của mình mới là yếu tố quan trọng.</strong></p><p>Một bản tóm tắt có thể cho chúng ta biết tác giả đã kết luận điều gì. Nhưng để hiểu được tại sao họ đi đến kết luận đó, đôi khi chúng ta vẫn cần đọc và suy nghĩ về toàn bộ lập luận.</p><h3>2. Tiếp cận những ý tưởng mới và học cách đánh giá chúng</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mTenuADBelBVFC2pDY4oyA.png" /></figure><p>Nhiều bước tiến quan trọng trong công nghệ bắt đầu từ nghiên cứu, trước khi được phát triển thành framework, thư viện hay sản phẩm thương mại.</p><p>Transformer là một ví dụ điển hình. Kiến trúc này được giới thiệu trong <em>Attention Is All You Need</em> từ năm 2017, trước khi trở thành nền tảng cho rất nhiều hệ thống AI hiện đại.</p><p>Đọc research paper giúp chúng ta tiếp cận những ý tưởng mới sớm hơn, thay vì phải đợi đến khi chúng xuất hiện trong các khóa học hoặc công cụ phổ biến.</p><p>Tuy nhiên, lợi ích không chỉ nằm ở việc biết cái gì mới, mà còn ở khả năng <strong>phân biệt một tiến bộ thực sự với những tuyên bố mang tính quảng bá (hype).</strong></p><p>Trong AI, gần như ngày nào cũng xuất hiện những mô hình mới, benchmark mới, hoặc những phương pháp được giới thiệu là vượt trội hơn thế hệ trước.</p><p>Nhưng một kết quả tốt hơn trên benchmark không đồng nghĩa với việc phương pháp đó phù hợp với mọi bài toán.</p><p>Chúng ta vẫn cần đặt câu hỏi: Dữ liệu được sử dụng có đại diện cho thực tế không? Baseline có công bằng không? Chi phí tính toán ra sao? Mức độ cải thiện có đủ lớn để đánh đổi lấy sự phức tạp khi triển khai không?</p><p>Những câu hỏi tương tự cũng xuất hiện khi đọc tài liệu thiết kế hệ thống, kiến trúc phần mềm hoặc phân tích những quyết định kỹ thuật.</p><p>Mình nghĩ đây là một kỹ năng quan trọng đối với Software Engineer và Data Scientist: <strong>Không chỉ biết một công nghệ mới tồn tại, mà còn có khả năng đánh giá khi nào nó thực sự đáng sử dụng.</strong></p><h3>3. Rèn luyện tư duy phản biện và khả năng giải quyết vấn đề</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r07iphF1pXTaCxKGE9kp4w.png" /></figure><p>Một trong những điều mình thích nhất khi đọc research paper là cấu trúc lập luận của nó.</p><p>Một paper thường bắt đầu bằng việc xác định vấn đề, đưa ra giả thuyết, đề xuất phương pháp, thiết kế thí nghiệm, phân tích kết quả và cuối cùng là rút ra kết luận.</p><p>Để hiểu được toàn bộ quá trình này, chúng ta phải liên tục đặt câu hỏi, kiểm tra giả định và xem xét mối liên hệ giữa bằng chứng với kết luận.</p><p>Đây cũng là một kỹ năng quan trọng trong công việc hằng ngày.</p><p>Ví dụ, khi một Data Scientist báo cáo rằng mô hình mới cải thiện accuracy thêm 5%, chúng ta không nên dừng lại ở con số 5%.</p><p>Sự cải thiện đó đến từ đâu? Có ổn định trên dữ liệu mới không? Có data leakage hay không? Metric được lựa chọn có thực sự phản ánh mục tiêu kinh doanh không?</p><p>Tương tự, khi một Software Engineer đề xuất thay đổi kiến trúc hệ thống để giảm latency, chúng ta cũng cần đánh giá khả năng mở rộng, chi phí, độ phức tạp và những rủi ro phát sinh.</p><p>Những vấn đề này không có một câu trả lời đúng cho mọi trường hợp.</p><p>Một giải pháp tốt đòi hỏi chúng ta phải hiểu bối cảnh, xác định giả định và cân nhắc các phương án khác nhau.</p><p>Và mình nghĩ việc thường xuyên đọc những tài liệu có cấu trúc lập luận chặt chẽ, rồi chủ động đánh giá những lập luận đó, là một cách để rèn luyện tư duy này.</p><p><strong>Mục tiêu không chỉ là học thêm kiến thức, mà còn là học cách đặt câu hỏi và đưa ra kết luận dựa trên bằng chứng.</strong></p><h3>4. Ghi nhớ kiến thức lâu hơn và tránh phụ thuộc quá mức vào AI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Luvxrbxnm8uKMFbVSg2TuA.png" /></figure><p>Đây có lẽ là lý do mình quan tâm nhất trong thời gian gần đây.</p><p>Khi AI có thể trả lời gần như mọi câu hỏi ngay lập tức, chúng ta rất dễ hình thành thói quen tiếp nhận thông tin một cách thụ động.</p><p>Gặp một vấn đề khó, chúng ta hỏi AI. Nhận được câu trả lời hợp lý, chúng ta tiếp tục công việc mà đôi khi chưa thực sự hiểu tại sao cách giải quyết đó lại đúng.</p><p>Trong tâm lý học nhận thức, có một khái niệm gọi là <em>cognitive offloading</em>, mô tả việc con người chuyển bớt công việc ghi nhớ hoặc xử lý thông tin sang các công cụ bên ngoài.</p><p>Một nghiên cứu nổi tiếng của Sparrow, Liu và Wegner (2011), đăng trên <em>Science</em>, đã tìm hiểu ảnh hưởng của việc có thể tra cứu thông tin trên Internet đối với trí nhớ.</p><p>Kết quả từ bốn thí nghiệm cho thấy khi người tham gia kỳ vọng rằng thông tin sẽ có thể được truy cập lại sau này, họ có xu hướng ghi nhớ thông tin ít hơn, nhưng lại nhớ tốt hơn nơi có thể tìm thấy nó.</p><p>Điều này không có nghĩa rằng Google hay AI khiến trí nhớ con người suy giảm. Nhưng nó cho thấy việc có thể truy cập thông tin dễ dàng có thể thay đổi cách chúng ta phân bổ nỗ lực ghi nhớ.</p><p>Một nghiên cứu khác của Karpicke và Blunt (2011), cũng được công bố trên <em>Science</em>, đã so sánh hiệu quả của các phương pháp học tập.</p><p>Trong một thí nghiệm, nhóm thực hành chủ động nhớ lại kiến thức (<em>retrieval practice</em>) đạt trung bình <strong>67%</strong> trong bài kiểm tra sau một tuần, so với <strong>45%</strong> ở nhóm sử dụng phương pháp lập sơ đồ khái niệm (<em>concept mapping</em>).</p><p>Kết quả này ủng hộ một nguyên tắc quan trọng: <strong>Việc chủ động nhớ lại và tái tạo kiến thức có thể hiệu quả hơn việc chỉ đọc hoặc xem lại thông tin.</strong></p><p>Vậy điều này liên quan gì đến việc đọc sâu?</p><p>Theo mình, khi đọc một tài liệu phức tạp, chúng ta có cơ hội thực hành những hoạt động nhận thức mà việc tiếp nhận một bản tóm tắt ngắn thường không đòi hỏi.</p><p>Chúng ta phải theo dõi những lập luận dài, kết nối các khái niệm, tự giải thích những công thức hoặc ý tưởng khó, và đôi khi phải đọc lại nhiều lần để hiểu được toàn bộ vấn đề.</p><p>Tuy nhiên, chỉ đọc lâu hơn chưa chắc đã giúp ghi nhớ tốt hơn. Điều quan trọng là biến quá trình đọc thành một hoạt động học tập chủ động: ghi chú, tự đặt câu hỏi, thử giải thích lại mà không nhìn tài liệu, hoặc áp dụng kiến thức vào một bài toán thực tế.</p><p>Đây cũng là cách mình nghĩ chúng ta nên sử dụng AI.</p><p>Thay vì luôn yêu cầu AI đưa ra đáp án ngay lập tức, chúng ta có thể sử dụng nó để gợi ý hướng giải quyết, đặt câu hỏi phản biện, kiểm tra cách hiểu của mình hoặc giải thích những khái niệm khó.</p><p><strong>AI có thể giúp chúng ta tiết kiệm thời gian tìm kiếm câu trả lời, nhưng không nên thay thế hoàn toàn quá trình tư duy cần thiết để thực sự hiểu câu trả lời đó.</strong></p><h3>Kết luận</h3><p>Mình không nghĩ Software Engineer hay Data Scientist nào cũng cần trở thành researcher, hoặc phải đọc hàng chục research paper mỗi tháng.</p><p>Thực ra, research paper cũng không phải loại tài liệu duy nhất mang lại những lợi ích kể trên.</p><p>Một cuốn sách chuyên ngành, tài liệu thiết kế hệ thống hoặc một tài liệu kỹ thuật có nội dung đủ chuyên sâu và cấu trúc chặt chẽ đều có thể là lựa chọn tốt.</p><p><strong>Điều quan trọng không hẳn là chúng ta đọc cái gì, mà là chúng ta đọc và học như thế nào.</strong></p><p>Trong một thế giới mà AI ngày càng giỏi tạo ra câu trả lời, mình nghĩ khả năng tư duy độc lập, hiểu sâu vấn đề và đánh giá thông tin sẽ ngày càng có giá trị.</p><p>Chúng ta không nhất thiết phải ghi nhớ mọi thứ, cũng không cần tự mình giải quyết tất cả vấn đề mà không có sự hỗ trợ của AI.</p><p>Nhưng chúng ta vẫn cần duy trì khả năng hiểu, kiểm chứng và đưa ra quyết định khi công cụ không có sẵn, đưa ra câu trả lời sai, hoặc gặp một vấn đề hoàn toàn mới.</p><p>Đó cũng là lý do mình muốn xây dựng một <strong>Research Paper Reading Club</strong>, nơi mọi người có thể cùng nhau đọc, đặt câu hỏi, tranh luận và chia sẻ những góc nhìn khác nhau.</p><p>Ngoài research paper, chúng ta hoàn toàn có thể mở rộng sang sách chuyên ngành hoặc những tài liệu kỹ thuật có giá trị.</p><p>Việc đọc và thảo luận cùng nhau không chỉ giúp duy trì thói quen mà còn tạo cơ hội để mỗi người thử giải thích những gì mình hiểu và học hỏi từ góc nhìn của người khác.</p><p><strong>Mục tiêu không phải là đọc được bao nhiêu paper, mà là sau mỗi tài liệu, chúng ta thực sự hiểu thêm được điều gì, có thể tự giải thích được điều gì, và áp dụng được điều gì vào công việc.</strong></p><h3>References</h3><ol><li>Bastani et al. (2025). <em>Generative AI without guardrails can harm learning: Evidence from high school mathematics.</em> PNAS.<br><a href="https://doi.org/10.1073/pnas.2422633122">https://doi.org/10.1073/pnas.2422633122</a></li><li>Chi et al. (1994). <em>Eliciting Self-Explanations Improves Understanding.</em> Cognitive Science.<br><a href="https://doi.org/10.1207/s15516709cog1803_3">https://doi.org/10.1207/s15516709cog1803_3</a></li><li>Sparrow, Liu &amp; Wegner (2011). <em>Google Effects on Memory: Cognitive Consequences of Having Information at Our Fingertips.</em> Science.<br><a href="https://doi.org/10.1126/science.1207745">https://doi.org/10.1126/science.1207745</a></li><li>Karpicke &amp; Blunt (2011). <em>Retrieval Practice Produces More Learning than Elaborative Studying with Concept Mapping.</em> Science.<br><a href="https://doi.org/10.1126/science.1199327">https://doi.org/10.1126/science.1199327</a></li><li>Vaswani et al. (2017). <em>Attention Is All You Need.</em> NeurIPS.<br><a href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28c067028efe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Khi ngay cả người giỏi nhất cũng cảm thấy mình chưa đủ giỏi]]></title>
            <link>https://medium.com/@williamhuybui/khi-ngay-c%E1%BA%A3-ng%C6%B0%E1%BB%9Di-gi%E1%BB%8Fi-nh%E1%BA%A5t-c%C5%A9ng-c%E1%BA%A3m-th%E1%BA%A5y-m%C3%ACnh-ch%C6%B0a-%C4%91%E1%BB%A7-gi%E1%BB%8Fi-9fe72d790da8?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe72d790da8</guid>
            <category><![CDATA[confidence]]></category>
            <category><![CDATA[wanghong]]></category>
            <category><![CDATA[vietnamese]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Sun, 26 Jul 2026 18:08:51 GMT</pubDate>
            <atom:updated>2026-07-26T18:08:51.182Z</atom:updated>
            <content:encoded><![CDATA[<p>Gần đây, nhà toán học Hong Wang nhận Fields Medal ở tuổi 35. Fields Medal là một trong những giải thưởng danh giá nhất của toán học, thường được ví như Nobel của ngành, dành cho các nhà toán học dưới 40 tuổi và chỉ được trao bốn năm một lần. Cô được vinh danh sau những đóng góp quan trọng trong việc giải quyết giả thuyết Kakeya trong không gian ba chiều, một bài toán hình học nổi tiếng có lịch sử hơn một thế kỷ. Hong Wang cũng trở thành người phụ nữ thứ ba trong lịch sử nhận Fields Medal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*3VRHN5feaKKvC9x2FJFKOQ.jpeg" /><figcaption>Source: Clay Mathematics Institute</figcaption></figure><p>Mình đọc khá nhiều bài viết về cô, nhưng điều khiến mình ấn tượng nhất không hẳn là những thành tựu toán học, mà là cách cô chia sẻ về nội quan (<strong>introspection</strong>), đặc biệt là cách cô đối mặt với cảm giác mình chưa đủ giỏi. Điều này đánh trúng nhiều suy nghĩ của mình, bởi rất khó hình dung một người đã đạt đến đỉnh cao như vậy vẫn có thể nghi ngờ chính bản thân. Nếu ngay cả một người như Hong Wang vẫn cảm thấy mình chưa đủ giỏi, thì có lẽ sự tự ti không đơn giản chỉ xuất phát từ việc chúng ta kém hơn người khác.</p><h3><strong>1. Hong Wang và cảm giác chưa đủ giỏi</strong></h3><p>Hong Wang yêu thích toán từ nhỏ, nhưng con đường của cô không phải câu chuyện quen thuộc về một thiên tài luôn đứng đầu ở mọi nơi mình đi qua. Khi vào Đại học Bắc Kinh, vì không đạt điểm cao nhất cho suất duy nhất vào ngành Toán năm đó, cô phải học Địa vật lý (geophysics) trước khi được chuyển sang Toán. Điều mình thấy thú vị là cha mẹ cô, dù đều là giáo viên, lại không tạo nhiều áp lực học hành. Tuổi thơ của cô ở Quế Lâm khá thong thả, với truyện, TV, bóng bàn, cầu lông và thời gian bên gia đình. Niềm yêu thích toán học của cô đến khá tự nhiên, thay vì bắt đầu từ kỳ vọng của cha mẹ.</p><p>Năm 2011, cô sang École Polytechnique ở Pháp. Đây không phải nơi niềm đam mê toán học của cô bắt đầu, nhưng là nơi nó được định hình rõ hơn khi cô nhận ra mình hợp với giải tích hơn đại số. Việc học cũng không hoàn toàn thuận lợi. Các lớp đều bằng tiếng Pháp, một ngôn ngữ cô chưa từng nói, nên cô phải dần học cách nghe hiểu thông qua những người xung quanh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/0*06VC9EdNe_LEoAPo" /></figure><p>Ngay cả khi đã đi khá xa trên con đường đó, Hong Wang vẫn từng nghĩ mình không đủ giỏi để làm nghiên cứu. Trong một kỳ thực tập, cô thử chuyển hướng sang kiến trúc vì nghi ngờ khả năng của bản thân. Sau đó, thay vì tiếp tục lo lắng mình có giỏi hay không, cô tập trung vào việc hiểu sâu hơn những vấn đề mình thực sự thích. Trong một chuyến thực tập nghiên cứu ở MIT năm 2013, một buổi seminar của Larry Guth đã giúp cô tìm lại hướng đi của mình. Một năm sau, cô bắt đầu học tiến sĩ tại MIT dưới sự hướng dẫn của chính ông.</p><p>Ở MIT, Hong Wang theo đuổi các bài toán Kakeya, một lĩnh vực rất khó và đã được nhiều nhà toán học hàng đầu nghiên cứu trong thời gian dài. Cô dần chứng minh được nhiều kết quả quan trọng, rồi cùng Joshua Zahl giải quyết giả thuyết Kakeya trong không gian ba chiều, một bài toán đã tồn tại gần một thế kỷ.</p><p>Nhìn từ bên ngoài, một thành tựu như vậy có lẽ đã đủ để một người không còn phải nghi ngờ năng lực của mình. Nhưng thực tế lại không đơn giản như vậy. Khi trở nên nổi tiếng, đặc biệt ở Trung Quốc, Hong Wang lại cảm thấy áp lực trước những lời ca ngợi và kỳ vọng xung quanh. Thành công không khiến cảm giác mình chưa đủ giỏi biến mất; đôi khi nó còn tạo ra một tiêu chuẩn mới mà cô cảm thấy mình phải tiếp tục đáp ứng.</p><p>Điều này khiến mình nghĩ nhiều về một câu hỏi: tại sao một người đã đạt đến mức gần như không còn gì phải chứng minh với người khác vẫn cảm thấy cần phải chứng minh với chính mình?</p><p>Bản thân từng theo đuổi toán học và có vài năm học tiến sĩ, mình khá quen với cảm giác này. Theo mình, có ba điều đáng nói khi nhìn vào sự tự ti của những người đã đi khá xa trong một lĩnh vực: môi trường và văn hóa mà chúng ta lớn lên, nhận thức ngày càng rõ về giới hạn kiến thức của bản thân, và hội chứng kẻ mạo danh.</p><h3>Khi thành tích trở thành thước đo của bản thân</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Bt6_xK_fujY3T7bHp_BnrA.jpeg" /></figure><p>Trong văn hóa phương Đông, đặc biệt ở những xã hội từng trải qua nhiều khó khăn, giáo dục thường được đặt ở vị trí rất cao. Điều này có lý do của nó. Với nhiều thế hệ, học hành là một trong những con đường rõ ràng nhất để có một tương lai tốt hơn, nên cha mẹ sẵn sàng hy sinh rất nhiều để con cái được học. Kết quả là nhiều nước châu Á có một nền giáo dục phổ thông rất cạnh tranh và tạo ra rất nhiều học sinh xuất sắc.</p><p>Tuy nhiên, có một điều mình thường suy nghĩ: điều gì xảy ra khi việc học dần không còn xuất phát từ sự tò mò, mà trở thành cách để chứng minh giá trị của bản thân?</p><p>Khi còn nhỏ, chúng ta cần điểm cao. Sau đó cần vào một trường tốt, có một công việc tốt, kiếm được nhiều tiền hơn, có một chức danh tốt hơn. Mỗi lần đạt được một cột mốc, một cột mốc khác lại xuất hiện. Nếu giá trị của bản thân luôn cần được xác nhận bởi thành tựu tiếp theo, rất khó để có một thời điểm chúng ta thực sự cảm thấy những gì mình đang có là đủ.</p><p>Theo mình, để đi rất xa trong một lĩnh vực, năng lực và kỷ luật là chưa đủ. Phải có một sự yêu thích xuất phát từ bên trong, bởi đến một lúc nào đó sẽ không còn bài kiểm tra để lấy điểm cao, không còn một giáo trình rõ ràng để biết mình cần học chương nào tiếp theo, và cũng không có ai đảm bảo rằng những năm mình bỏ ra sẽ mang lại kết quả.</p><p>Câu chuyện của Hong Wang khiến mình nghĩ đến điều này. Cha mẹ cô đều là giáo viên nhưng không biến việc học thành toàn bộ tuổi thơ của con. Cô có thời gian đọc truyện, xem TV, chơi thể thao và tự tìm đến toán học vì tò mò. Có lẽ chính việc không phải liên tục chứng minh mình giỏi đã cho cô không gian để tìm ra thứ mình thực sự thích.</p><p>Sau khoảng 15 năm sống giữa hai nền văn hóa, mình cũng cảm nhận khá rõ sự khác biệt này. Một môi trường mà mọi người ít quan tâm hơn đến việc bạn học gì, mặc gì, kiếm bao nhiêu tiền, đi xe gì hay đang thành công đến đâu đôi khi lại cho mình nhiều không gian hơn để suy nghĩ độc lập. Khi không phải liên tục nhìn sang bên cạnh để xem người khác đang ở đâu, mình mới có thời gian tự hỏi mình thực sự muốn đi đâu.</p><p>Tất nhiên, áp lực không phải lúc nào cũng xấu. Có những áp lực giúp mình kỷ luật hơn, cố gắng hơn và không dễ dàng bỏ cuộc. Nhưng cũng có những áp lực khiến mọi thành tựu chỉ trở thành một nghĩa vụ mới: mình đạt được điều này thì bây giờ phải đạt được điều tiếp theo để chứng minh rằng thành công trước đó không phải may mắn. Ranh giới giữa hai loại áp lực này đôi khi rất khó nhận ra.</p><h3>Càng biết nhiều càng thấy mình biết ít</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sOCpZyNZetUA2nGXGSbs7g.png" /></figure><p>Có một trải nghiệm mà mình nghĩ hầu hết những người từng đi sâu vào một lĩnh vực đều hiểu. Khi mới bắt đầu học, mọi thứ thường trông đơn giản hơn thực tế. Sau một thời gian, khi hiểu thêm, mình bắt đầu nhìn thấy những lớp phức tạp mà trước đây thậm chí không biết là chúng tồn tại.</p><p>Hiệu ứng Dunning–Kruger thường được nhắc đến trong những cuộc thảo luận kiểu này. Mình thích hình ảnh “thung lũng tuyệt vọng” (Valley of Despair) như một cách mô tả cảm giác khi đã biết đủ nhiều để nhận ra một lĩnh vực rộng đến mức nào, nhưng lại chưa đủ giỏi để cảm thấy mình thật sự làm chủ nó.</p><p>AI là một ví dụ rất điển hình trong thời điểm hiện tại. Một người mới bắt đầu dùng ChatGPT có thể có cảm giác rằng AI làm được gần như mọi thứ. Nhưng khi bắt đầu biến AI thành một công cụ thực sự hữu ích trong công việc, mọi thứ trở nên phức tạp hơn rất nhanh. Có model, data, evaluation, retrieval, agents, context, latency, cost, security, deployment, và mỗi thứ lại mở ra hàng loạt vấn đề khác.</p><p>Mình làm việc với AI gần sáu năm, sử dụng nó rất nhiều mỗi ngày và đã làm khá nhiều ứng dụng liên quan, nhưng vẫn thường xuyên gặp những thứ khiến mình cảm thấy kiến thức của bản thân rất nhỏ. Trước đây mình nghĩ cảm giác này có nghĩa là mình chưa đủ giỏi. Sau này mình nhận ra đôi khi nó chỉ có nghĩa là tầm nhìn của mình đã rộng hơn. Khi mình chỉ biết một căn phòng, căn phòng đó có vẻ rất lớn. Đến khi mở cửa và nhìn thấy cả một thành phố, căn phòng tự nhiên trở nên nhỏ đi, dù kích thước của nó chẳng thay đổi.</p><p>Kiến thức vì vậy có một nghịch lý khá thú vị. Nó giúp mình biết nhiều hơn, nhưng đồng thời cũng làm mình nhận thức rõ hơn về những thứ mình không biết. Trong những lĩnh vực gần như không có điểm kết thúc như toán học hay AI, cảm giác này có thể lặp lại rất nhiều lần. Mỗi lần tưởng mình đã leo ra khỏi một “thung lũng”, mình lại nhìn thấy một ngọn núi khác ở phía trước.</p><h3>Hội chứng kẻ mạo danh</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*QkQYd0KECdRayVsPEtUIQA.jpeg" /></figure><p>Hội chứng kẻ mạo danh (imposter syndrome) là cảm giác hoài nghi về năng lực của chính mình dù đã có những thành tựu thực tế. Người trải qua cảm giác này thường cho rằng thành công của mình đến từ may mắn, hoàn cảnh hoặc sự đánh giá quá cao của người khác, và lo rằng một ngày nào đó mọi người sẽ nhận ra mình không giỏi như họ vẫn nghĩ.</p><p>Với một người nghiên cứu toán học như Hong Wang, cảm giác này có lẽ càng dễ xuất hiện. Nghiên cứu là một con đường rất cô đơn. Khi đi đủ sâu, số người làm đúng vấn đề mình đang làm ngày càng ít, số người thực sự hiểu công việc của mình cũng ít đi, và không còn một thước đo rõ ràng để biết mình đang làm tốt đến đâu. Có những bài toán bạn có thể dành nhiều năm mà không biết cuối cùng mình có giải được hay không.</p><p>Nhưng điều này không chỉ xảy ra trong nghiên cứu. Nó cũng xuất hiện khi một người làm startup, tự kinh doanh, chuyển ngành, nhận một công việc mới hoặc chọn một con đường mà những người xung quanh chưa từng đi. Khi không còn một lộ trình có sẵn để so sánh, mình rất dễ tự hỏi liệu mình có đang làm đúng hay không, hoặc mình có thực sự đủ khả năng để đứng ở vị trí hiện tại hay không.</p><p>Bản thân mình đã trải qua cảm giác đó nhiều lần, đặc biệt trong những năm học tiến sĩ và mỗi khi đổi job. Xung quanh mình có rất nhiều người giỏi, nhưng mình không biết họ đã biết những gì, còn mình thiếu những gì. Trong đầu luôn có một áp lực rằng mình phải làm được điều gì đó để chứng minh mình đủ giỏi để có mặt ở đó.</p><p>Trong một thời gian dài, mình nghĩ cách giải quyết là chứng minh rằng mình thực sự đủ giỏi. Nhưng vấn đề của cách này là nó gần như không có điểm kết thúc. Hôm nay mình chứng minh mình đủ giỏi để vào một chương trình tiến sĩ, ngày mai lại phải chứng minh mình đủ giỏi để làm nghiên cứu. Có công việc rồi lại phải chứng minh mình xứng đáng với công việc đó. Được thăng chức thì tiêu chuẩn lại thay đổi. Mỗi khi bước lên một môi trường mới, mình lại gặp những người giỏi hơn và quá trình đó bắt đầu lại.</p><p>Có lẽ vì vậy thành tựu không phải lúc nào cũng chữa được sự tự ti. Nếu sự tự tin của mình phụ thuộc vào thành tựu tiếp theo, thì mỗi thành công chỉ giúp mình yên tâm trong một khoảng thời gian ngắn trước khi một tiêu chuẩn mới xuất hiện. Fields Medal có thể chứng minh với cả thế giới rằng Hong Wang là một nhà toán học xuất sắc, nhưng nó không nhất thiết khiến cô cảm thấy mình không còn gì phải chứng minh với chính mình.</p><p>Cách còn lại có lẽ khó hơn, nhưng bền vững hơn: chấp nhận rằng mình có thể giỏi ở một vài thứ, chưa giỏi ở rất nhiều thứ khác, và không cần phải biết mọi thứ mới xứng đáng có mặt ở nơi mình đang đứng. Việc nhận ra mình còn thiếu sót không nhất thiết phải dẫn đến tự ti; đôi khi nó đơn giản chỉ là một đánh giá thực tế về bản thân.</p><p>Điều mình thích ở câu chuyện của Hong Wang là cách cô đối mặt với áp lực không có gì quá đặc biệt. Cô tập yoga, đi bộ vào sáng sớm để ngắm những chú chó ở Washington Square Park và dành thời gian cho bạn bè. Những điều nghe rất bình thường này lại quan trọng, bởi chúng tạo ra những khoảng thời gian mà cuộc sống không xoay quanh việc giải một bài toán, đạt thêm một thành tựu hay chứng minh mình giỏi đến đâu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*TRrW2A4TuTGojwKyKE8TCg.jpeg" /></figure><p>Có lẽ đó cũng là điều mình rút ra nhiều nhất từ câu chuyện của cô. Trước đây mình nghĩ sự tự tin là trạng thái mà một ngày nào đó, sau khi đủ giỏi và đạt đủ nhiều thứ, mình sẽ không còn nghi ngờ bản thân nữa. Bây giờ mình không chắc trạng thái đó thực sự tồn tại. Càng đi xa, mình càng gặp những người giỏi hơn, những vấn đề khó hơn và càng nhận ra thế giới rộng hơn những gì mình từng nghĩ.</p><p>Vì vậy, có lẽ mục tiêu không phải là loại bỏ hoàn toàn sự tự ti, mà là không để nó quyết định cách mình nhìn nhận giá trị của bản thân. Mình có thể chưa đủ giỏi để làm một điều gì đó hôm nay nhưng vẫn có thể học. Mình có thể bước vào một căn phòng và không phải là người giỏi nhất trong đó mà vẫn có lý do để ở lại. Mình cũng có thể đạt được một thành công mà không lập tức biến nó thành áp lực phải đạt được một thứ lớn hơn.</p><p>Với những người có nhiều ambition và obsession, điều này có lẽ khó hơn, vì lúc nào cũng có một mục tiêu tiếp theo để theo đuổi. Nhưng chính vì vậy, đôi khi càng cần biết lúc nào nên dừng lại một chút, ghi nhận những gì mình đã làm được, dành thời gian cho bạn bè, tập thể thao, đi bộ, hay đơn giản là làm một việc không giúp mình giỏi hơn và cũng chẳng đóng góp gì cho công việc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pbUbM7q9SCY_26Uj2JL9Jg.jpeg" /></figure><p>Thiên tài cuối cùng cũng là con người. Họ cũng có lúc tự ti, cô đơn, mệt mỏi và không biết mình có đang đi đúng hướng hay không. Có lẽ điều khác biệt không phải là họ đã loại bỏ được những cảm giác đó, mà là họ vẫn tìm được lý do để tiếp tục làm điều mình yêu thích dù những cảm giác ấy vẫn tồn tại.</p><p>𝗖𝗼𝗻𝗳𝗶𝗱𝗲𝗻𝗰𝗲 𝗶𝘀𝗻’𝘁 𝗸𝗻𝗼𝘄𝗶𝗻𝗴 𝘆𝗼𝘂’𝗿𝗲 𝗴𝗼𝗼𝗱 𝗲𝗻𝗼𝘂𝗴𝗵; 𝗶𝘁’𝘀 𝗯𝗲𝗶𝗻𝗴 𝗼𝗸𝗮𝘆 𝘄𝗶𝘁𝗵 𝗻𝗼𝘁 𝗸𝗻𝗼𝘄𝗶𝗻𝗴.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe72d790da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Check if Bitwise OR Has Trailing Zeros — Leetcode 2980 Explained]]></title>
            <link>https://medium.com/@williamhuybui/check-if-bitwise-or-has-trailing-zeros-leetcode-2980-explained-84265b8a3831?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/84265b8a3831</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[bitwise-operator]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Sat, 12 Apr 2025 17:34:46 GMT</pubDate>
            <atom:updated>2025-04-12T17:51:10.167Z</atom:updated>
            <content:encoded><![CDATA[<h3>Check if Bitwise OR Has Trailing Zeros — Leetcode 2980 Explained</h3><p>A step-by-step breakdown from brute force to optimal logic with intuition and Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8oUJirTSsXSsMRWpL1llVg.png" /></figure><h3>Problem Statement</h3><p>You are given an array of <strong>positive</strong> integers nums.</p><p>You have to check if it is possible to select <strong>two or more</strong> elements in the array such that the bitwise OR of the selected elements has <strong>at least </strong>one trailing zero in its binary representation.</p><p>For example, the binary representation of 5, which is &quot;101&quot;, does not have any trailing zeros, whereas the binary representation of 4, which is &quot;100&quot;, has two trailing zeros.</p><p>Return true <em>if it is possible to select two or more elements whose bitwise</em> OR <em>has trailing zeros, return</em> false <em>otherwise</em>.</p><p><strong>Example 1:</strong></p><pre>Input: nums = [1,2,3,4,5]<br>Output: true</pre><p><strong>Explanation</strong>: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation “110” with one trailing zero.</p><p><strong>Example 2:</strong></p><pre>Input: nums = [2,4,8,16]<br>Output: true</pre><p><strong>Explanation</strong>: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation “110” with one trailing zero. Other possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16).</p><p><strong>Example 3:</strong></p><pre>Input: nums = [1,3,5,7,9]<br>Output: false</pre><p><strong>Explanation</strong>: There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR.</p><h3>What is OR operation?</h3><p>The <strong>bitwise OR</strong> operation ( | ) return 1 if at least <strong>one of the input bits is 1</strong>. The following is the truth table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*WmcdsbQBtAg95l95Mi4lOw.png" /><figcaption>Truth table for Bitwise OR</figcaption></figure><p>To perform the OR operation on decimal numbers, we need to convert them to binary and compare each bit. For example, to find 5|11, we have 5 = 101 and 11 = 1011 , so</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*prviHcMB2MpkoztNPwKehA.png" /></figure><p>then, 5|11 = 1111 = 15.</p><h3>Building intuition</h3><p>The problem requires computing <strong>bitwise OR</strong> of <strong>at least 2 numbers</strong> such that the result has at least <strong>one trailing zero</strong>. A brute-force approach would involve checking all subsets of size 2 or more</p><pre>nums = [1,2,3,4]<br><br>[1,2] -&gt; 01|10 = 11<br>[1,3] -&gt; 01|11 = 11<br>[1,4] -&gt; 001|100 = 101 (trailing zero)<br>[2,3] -&gt; 10|11 = 11<br>[2,4] -&gt; 010|100 = 110<br>[3,4] -&gt; 011|100 = 111<br>[1,2,3] -&gt; 01|10|11 = 11<br>[2,3,4] -&gt; 010|011|100 = 111<br>[1,3,4] -&gt; 001|011|100 = 111<br>[1,2,4] -&gt; 001|010|100 = 111<br>[1,2,3,4] -&gt; 001|010|011|100 = 111</pre><p>There are2^N number of subsets, which mean this approach runs in O(2^N) time.</p><h3>Better way</h3><p>The key insight to ask is: <strong>What causes a trailing zero?</strong></p><p>From the truth table, we found that the only case that result 0 is when 0|0 . We also know that any binary representation that end with 0 is an <strong>even</strong> number.</p><p>Therefore, the only possible way to have the ending 0 is when we bitwise OR 2 even numbers. In other words, we only need to check if the array <strong>contain 2 even numbers</strong>!</p><h3><strong>Implementation</strong></h3><p>Once the strategy has established, the implementation is fairly simple</p><pre>class Solution:<br>    def hasTrailingZeros(self, nums: List[int]) -&gt; bool:<br>        count = 0<br>        for num in nums:<br>            if num % 2 == 0:<br>                count += 1<br>            if count &gt; 1:<br>                return True<br>        return False</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84265b8a3831" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maximize Your Coding Skills with Python Counter Techniques]]></title>
            <link>https://medium.com/@williamhuybui/maximize-your-coding-skills-with-python-counter-techniques-bf52ad1c5310?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf52ad1c5310</guid>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[counter]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 21:39:18 GMT</pubDate>
            <atom:updated>2023-08-15T21:39:18.255Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DK7nmoLnDCidRxHUYJpsMA.png" /><figcaption>Image by Huy Bui</figcaption></figure><h3>Introduction</h3><p>Python’s Counter, a member of the collections module, is a powerful tool that helps in various practical scenarios. From acing coding interviews to writing clean and efficient code, understanding Counter is a stepping stone to career growth. This article provides insights into various Counter tricks, comparing them with traditional methods to enhance your intuition.</p><h4>1. Basics of Counter</h4><p><strong>What is Counter?</strong></p><p>Counter, a built-in function in Python, resembles a dictionary in structure. It’s a key-value storage tool that can provide a competitive edge in interviews, especially when it comes to solving complex problems.</p><p><strong>Using Counter vs. Dictionary</strong></p><p>Consider this simple problem of counting the frequency of values in a list:</p><p><strong>With Dictionary:</strong></p><pre>nums = [1,1,2,2,3,4,4]<br>def count_freq(nums):<br>  h_map = {}<br>  for num in nums:<br>    if num in h_map:<br>      h_map[num]+=1<br>  else:<br>    h_map[num]=1<br>    return h_map<br><br>count_freq(nums)<br># Output: {1: 2, 2: 2, 3: 1, 4: 3}</pre><p><strong>With Counter:</strong></p><pre>from collections import Counter<br>print(Counter(nums))<br># Output: Counter({4: 3, 1: 2, 2: 2, 3: 1})</pre><h4>2. Finding the Most Common Elements</h4><p><strong>Problem Statement</strong></p><p>Find k most common characters in a string.</p><p>Input: k=2, s=&quot;aabbacacc&quot;</p><p>Output: [(&quot;a&quot;:4),(&quot;c&quot;:3)]</p><p><strong>Traditional Solution</strong></p><ol><li>Count the frequency of the character and store in a hash map.</li><li>Sort the frequency in descending order and choose k of them.</li><li>Loop through the hash map and select values in list (2).</li></ol><pre>h_map = Counter(s)<br>values = sorted(Counter(s).values(), reverse=True)<br>k_values = values[:k]<br>res = [] <br>for key in h_map:<br>  if h_map[key] in k_values:<br>    res.append((key, h_map[key]))</pre><p><strong>With Counter:</strong></p><pre>Counter(s).most_common(k)</pre><h4>3. Counter’s Addition and Subtraction</h4><p>Counter allows the addition (`+`) and subtraction (`-`) of two Counter objects, making it much easier to combine or differentiate collections.</p><p><strong>Addition</strong></p><p>You can combine two Counters easily with the `+` operator.</p><pre>from collections import Counter<br>dict1 = Counter({&#39;a&#39;: 2, &#39;b&#39;: 2, &#39;c&#39;: 1})<br>dict2 = Counter({&#39;a&#39;: 2, &#39;b&#39;: 4, &#39;e&#39;: 3})<br>result = dict1 + dict2<br>print(result) <br># Output: Counter({&#39;b&#39;: 6, &#39;a&#39;: 4, &#39;e&#39;: 3, &#39;c&#39;: 1})</pre><p><strong>Subtraction</strong></p><p>Similarly, you can find the difference between two Counters with the `-` operator.</p><pre>result = dict2 - dict1<br>print(result) <br># Output: Counter({&#39;b&#39;: 2, &#39;e&#39;: 3, &#39;a&#39;: 0})</pre><h4>4. Intersection and Union</h4><p>Counter also provides methods for intersection (`&amp;`) and union (`|`), very useful in solving various problems.</p><p><strong>Intersection</strong></p><p>The intersection of two Counters retains the minimum of corresponding counts.</p><pre>from collections import Counter<br>dict1 = Counter({&#39;a&#39;: 3, &#39;b&#39;: 2, &#39;c&#39;: 1})<br>dict2 = Counter({&#39;a&#39;: 2, &#39;b&#39;: 4, &#39;e&#39;: 3})<br>intersection = dict1 &amp; dict2<br>print(intersection) # Output: Counter({&#39;a&#39;: 2, &#39;b&#39;: 2})</pre><p><strong>Union</strong></p><p>The union of two Counters retains the maximum of corresponding counts.</p><pre>union = dict1 | dict2<br>print(union) # Output: Counter({&#39;b&#39;: 4, &#39;a&#39;: 3, &#39;e&#39;: 3, &#39;c&#39;: 1})</pre><p><strong>Problem Statement</strong></p><p>Given two string arrays `words1` and `words2`, find universal strings in `words1` that contain every string in `words2`.</p><pre>words1 = [&quot;cccbb&quot;, &quot;aacbc&quot;, &quot;bbccc&quot;, &quot;baaba&quot;, &quot;acaba&quot;]<br>words2 = [&quot;cb&quot;, &quot;b&quot;]</pre><p><strong>Traditional Method:</strong></p><pre>from collections import Counter<br><br># Finding Union<br>union = Counter()<br>for w in words2:<br>    c = Counter(w)<br>    for key in c:<br>        if key in union:<br>            union[key] = max(union[key], c[key])<br>        else:<br>            union[key] = c[key]<br># Find intersection<br>res = [] #Your answer<br>for w in words1:<br>    c = Counter(w)<br>    flag = True<br>    for key in union:<br>        if key not in c or c[key] &lt; union[key]:<br>            flag = False<br>    if flag:<br>        res.append(w)</pre><p><strong>Using Union and Intersection</strong></p><pre>from collections import Counter<br><br>union = Counter()<br>for w in words2:<br>    union |= Counter(w)<br>res = [w for w in words1 if Counter(w) &amp; union == union]</pre><h3>Conclusion</h3><p>The mathematical operations within Counter are truly remarkable. They allow for a diverse set of key-wise operations such as addition, subtraction, intersection, union, equality, and inclusion. Learning these can not only enhance your interview performance but also contribute to your overall development as a programmer. Explore and practice these techniques to take your Python skills to new heights!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf52ad1c5310" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an Analog Clock with HTML, CSS, and JavaScript]]></title>
            <link>https://medium.com/@williamhuybui/creating-an-analog-clock-with-html-css-and-javascript-32a254da8a9e?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/32a254da8a9e</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Mon, 03 Jul 2023 04:00:01 GMT</pubDate>
            <atom:updated>2023-08-15T21:41:09.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYOsP7XXEZe2L9TrK3E4Ug.png" /></figure><p>An analog clock is a timeless classic that not only tells time but also adds a touch of elegance to any website or application. In this tutorial, we will walk you through the process of creating an analog clock using HTML, CSS, and JavaScript. Let’s get started!</p><h3>HTML Structure</h3><p>First, let’s set up the HTML structure for our analog clock. Open your favorite text editor and create a new HTML file. Copy and paste the following code into your HTML file:</p><pre><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br> &lt;meta charset=&quot;UTF-8&quot;&gt;<br> &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br> &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;<br> &lt;title&gt;Analog Clock Tutorial&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br> &lt;div class=&quot;container&quot;&gt;<br> &lt;div class=&quot;clock-outer&quot;&gt;&lt;/div&gt;<br> &lt;div class=&quot;clock&quot;&gt;<br> &lt;! - Clock numbers →<br> &lt;div class=&quot;number number1&quot;&gt;1&lt;/div&gt;<br> &lt;div class=&quot;number number2&quot;&gt;2&lt;/div&gt;<br> &lt;div class=&quot;number number3&quot;&gt;3&lt;/div&gt;<br> &lt;div class=&quot;number number4&quot;&gt;4&lt;/div&gt;<br> &lt;div class=&quot;number number5&quot;&gt;5&lt;/div&gt;<br> &lt;div class=&quot;number number6&quot;&gt;6&lt;/div&gt;<br> &lt;div class=&quot;number number7&quot;&gt;7&lt;/div&gt;<br> &lt;div class=&quot;number number8&quot;&gt;8&lt;/div&gt;<br> &lt;div class=&quot;number number9&quot;&gt;9&lt;/div&gt;<br> &lt;div class=&quot;number number10&quot;&gt;10&lt;/div&gt;<br> &lt;div class=&quot;number number11&quot;&gt;11&lt;/div&gt;<br> &lt;div class=&quot;number number12&quot;&gt;12&lt;/div&gt;<br>&lt;! - Date and month display →<br> &lt;div class=&quot;container-2&quot;&gt;<br> &lt;div id=&quot;date&quot;&gt;7&lt;/div&gt;<br> &lt;div id=&quot;month&quot;&gt;22&lt;/div&gt; <br> &lt;/div&gt;<br>&lt;! - Clock hands →<br> &lt;div id=&quot;hour-hand&quot; class=&quot;hand hour&quot;&gt;&lt;/div&gt;<br> &lt;div id=&quot;minute-hand&quot; class=&quot;hand minute&quot;&gt;&lt;/div&gt; <br> &lt;div id=&quot;second-hand&quot; class=&quot;hand second&quot;&gt;&lt;/div&gt;<br> <br> &lt;! - Small circle in the center →<br> &lt;div id=&quot;small-circle&quot;&gt;&lt;/div&gt; <br> &lt;/div&gt;<br> &lt;/div&gt;<br> &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Save the file with a .html extension, for example, index.html. This HTML structure defines a container with a clock design, including clock numbers, clock hands, and a small circle in the center.</p><h3>HTML Breakdown</h3><p>The code starts with the usual HTML document structure. It includes the &lt;head&gt; section where you define the character encoding, viewport settings, link to the CSS file, and the page title.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;<br>    &lt;title&gt;Analog Clock Tutorial&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;</pre><p>Next, we have a &lt;div&gt; element with the class &quot;container&quot; which acts as the outer container for the entire clock. Inside this container, we have two more &lt;div&gt; elements. The first one has the class &quot;clock-outer&quot; and is responsible for creating the outer circle of the clock. The second &lt;div&gt; has the class &quot;clock&quot; and acts as the main clock face.</p><pre>&lt;div class=&quot;container&quot;&gt;<br> &lt;div class=&quot;clock-outer&quot;&gt;&lt;/div&gt;<br> &lt;div class=&quot;clock&quot;&gt;</pre><p>Inside the “clock” &lt;div&gt;, we have twelve individual &lt;div&gt; elements with the classes &quot;number&quot; and &quot;numberX&quot; (where X represents the numbers 1 to 12). These elements represent the hour numbers on the clock face.</p><pre>            &lt;div class=&quot;number number1&quot;&gt;1&lt;/div&gt;<br>            &lt;div class=&quot;number number2&quot;&gt;2&lt;/div&gt;<br>            &lt;div class=&quot;number number3&quot;&gt;3&lt;/div&gt;<br>            &lt;div class=&quot;number number4&quot;&gt;4&lt;/div&gt;<br>            &lt;div class=&quot;number number5&quot;&gt;5&lt;/div&gt;<br>            &lt;div class=&quot;number number6&quot;&gt;6&lt;/div&gt;<br>            &lt;div class=&quot;number number7&quot;&gt;7&lt;/div&gt;<br>            &lt;div class=&quot;number number8&quot;&gt;8&lt;/div&gt;<br>            &lt;div class=&quot;number number9&quot;&gt;9&lt;/div&gt;<br>            &lt;div class=&quot;number number10&quot;&gt;10&lt;/div&gt;<br>            &lt;div class=&quot;number number11&quot;&gt;11&lt;/div&gt;<br>            &lt;div class=&quot;number number12&quot;&gt;12&lt;/div&gt;</pre><p>Next section contains a separate &lt;div&gt; element with the class &quot;container-2&quot;. Inside it, we have two child &lt;div&gt; elements with the ids &quot;date&quot; and &quot;month&quot;. These elements display the current date and month on the clock face.</p><pre>            &lt;div class=&quot;container-2&quot;&gt;<br>                &lt;div id=&quot;date&quot;&gt;7&lt;/div&gt;<br>                &lt;div id=&quot;month&quot;&gt;22&lt;/div&gt;   <br>            &lt;/div&gt;</pre><p>We also have four &lt;div&gt; elements that represent the clock hands. Each hand is given an id (&quot;hour-hand&quot;, &quot;minute-hand&quot;, &quot;second-hand&quot;) and a common class &quot;hand&quot;. Additionally, the second hand has the class &quot;second&quot;, the minute hand has the class &quot;minute&quot;, and the hour hand has the class &quot;hour&quot;. These classes are used for styling purposes. Lastly, there is a separate &lt;div&gt; with the id &quot;small-circle&quot; which represents the small circle in the center of the clock face.</p><pre>            &lt;div id=&quot;hour-hand&quot; class=&quot;hand hour&quot;&gt;&lt;/div&gt;<br>            &lt;div id=&quot;minute-hand&quot; class=&quot;hand minute&quot;&gt;&lt;/div&gt;  <br>            &lt;div id=&quot;second-hand&quot; class=&quot;hand second&quot;&gt;&lt;/div&gt;<br>            <br>            &lt;div id=&quot;small-circle&quot;&gt;&lt;/div&gt;  <br>        &lt;/div&gt;<br>    &lt;/div&gt;</pre><p>Finally, we end the HTML document with the closing &lt;script&gt; tag to include the JavaScript file &quot;script.js&quot;, and close the `&lt;</p><pre>    &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Styling with CSS</h3><p>Let’s add some CSS styles to make our analog clock visually appealing. Create a new CSS file and name it style.css. Copy and paste the following CSS code into the file:</p><pre>.clock-outer {<br> width: 420px;<br> height: 420px;<br> border: 15px solid;<br> border-radius: 50%;<br> position: relative;<br> background: lime;<br>}<br>.clock {<br> width: 400px;<br> height: 400px;<br> border: 2px solid black;<br> border-radius: 50%;<br> font-family: &#39;Franklin Gothic Medium&#39;, &#39;Arial Narrow&#39;, Arial, sans-serif;<br> position: absolute;<br> background: #f1f1f1;<br>}<br>.container {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> height: 100vh;<br> background-color: rgba(0, 0, 0, 0.3);<br>}<br>.clock .number {<br> position: absolute;<br> width: 100<br>%;<br> height: 100%;<br> text-align: center;<br> font-size: 1.5rem;<br>}<br>.clock .hand {<br> - rotation: 10;<br> position: absolute;<br> background-color: black;<br> border: 1px solid white;<br> border-top-left-radius: 10px;<br> border-top-right-radius: 10px;<br> left: 50%;<br> bottom: 50%;<br> transform-origin: bottom;<br> transform: translateX(-50%) rotate(calc(var( - rotation) * 1deg));<br>}<br>.clock .hand.minute {<br> height: 40%;<br> width: 5px;<br>}<br>#small-circle {<br> position: absolute;<br> width: 20px;<br> height: 20px;<br> border-radius: 50%;<br> background-color: red;<br> left: 50%;<br> bottom: 48%;<br> transform: translateX(-50%);<br>}<br>.clock .hand.second {<br> height: 48%;<br> width: 3px;<br> background: red;<br>}<br>.clock .hand.hour {<br> height: 30%;<br> width: 10px;<br>}<br>.container-2 {<br> display: flex;<br> position: absolute;<br> bottom: 44%;<br> left: 68%;<br> border: 2px solid black;<br> border-radius: 10px;<br> width: 80px;<br> height: 50px;<br> font-size: 1.3rem;<br>}<br>.container-2 #date {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> border-right: 1px solid black;<br> width: 40px;<br> height: 50px;<br> font-family: &#39;Trebuchet MS&#39;, &#39;Lucida Sans Unicode&#39;, &#39;Lucida Grande&#39;, &#39;Lucida Sans&#39;, Arial, sans-serif;<br>}<br>.container-2 #month {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> width: 40px;<br> height: 50px;<br> font-family: &#39;Trebuchet MS&#39;, &#39;Lucida Sans Unicode&#39;, &#39;Lucida Grande&#39;, &#39;Lucida Sans&#39;, Arial, sans-serif;<br>}<br>.number1 {<br> transform: rotate(30deg);<br>}<br>.number2 {<br> transform: rotate(60deg);<br>}<br>.number3 {<br> transform: rotate(90deg);<br>}<br>.number4 {<br> transform: rotate(120deg);<br>}<br>.number5 {<br> transform: rotate(150deg);<br>}<br>.number6 {<br> transform: rotate(180deg);<br>}<br>.number7 {<br> transform: rotate(210deg);<br>}<br>.number8 {<br> transform: rotate(240deg);<br>}<br>.number9 {<br> transform: rotate(270deg);<br>}<br>.number10 {<br> transform: rotate(300deg);<br>}<br>.number11 {<br> transform: rotate(330deg);<br>}</pre><p>Save the CSS file, and make sure it is linked to your HTML file by adding the following line in the &lt;head&gt; section of your HTML file:</p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;</pre><p>The CSS code above defines the styles for the clock container, clock design, clock numbers, clock hands, and the small circle in the center.</p><h3>CSS Breakdown</h3><p>Let’s break down the CSS part of the code step by step:</p><pre>.clock-outer {<br> width: 420px;<br> height: 420px;<br> border: 15px solid;<br> border-radius: 50%;<br> position: relative;<br> background: lime;<br>}<br>.clock {<br> width: 400px;<br> height: 400px;<br> border: 2px solid black;<br> border-radius: 50%;<br> font-family: &#39;Franklin Gothic Medium&#39;, &#39;Arial Narrow&#39;, Arial, sans-serif;<br> position: absolute;<br> background: #f1f1f1;<br>}</pre><p>These styles are applied to the clock’s outer container (clock-outer) and the clock face container (clock). The clock-outer class defines the dimensions, border, border-radius, position, and background color of the outer container. The clock class sets the dimensions, border, border-radius, font-family, position, and background color of the clock face.</p><pre>.container {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> height: 100vh;<br> background-color: rgba(0, 0, 0, 0.3);<br>}</pre><p>The .container class is applied to the main container holding the clock. It uses flexbox to center the clock horizontally and vertically within the container. It also sets the height to 100% of the viewport height (100vh) and applies a semi-transparent black background color.</p><pre>.clock .number {<br> position: absolute;<br> width: 100%;<br> height: 100%;<br> text-align: center;<br> font-size: 1.5rem;<br>}</pre><p>The .clock .number selector applies styles to the clock numbers (1 to 12) inside the clock face. It positions them absolutely within the clock face, sets their width and height to 100% to cover the entire clock face, centers the text horizontally using text-align: center, and sets the font size to 1.5rem.</p><pre>.clock .hand {<br> - rotation: 10;<br> position: absolute;<br> background-color: black;<br> border: 1px solid white;<br> border-top-left-radius: 10px;<br> border-top-right-radius: 10px;<br> left: 50%;<br> bottom: 50%;<br> transform-origin: bottom;<br> transform: translateX(-50%) rotate(calc(var( - rotation) * 1deg));<br>}</pre><p>The .clock .hand selector applies styles to the clock hands. It sets the initial rotation angle using a CSS variable (— rotation: 10) which can be modified dynamically. The hands have a position of absolute within the clock face, a black background color, a white border, and border-radius applied to the top-left and top-right corners. The left and bottom properties are set to 50% to position the hands at the center of the clock face, and the transform-origin property is set to bottom to rotate the hands from their bottom ends. The transform property uses translateX(-50%) to horizontally center the hands and rotate(calc(var( — rotation) * 1deg)) to apply the rotation.</p><pre>#small-circle {<br> position: absolute;<br> width: 20px;<br> height: 20px;<br> border-radius: 50%;<br> background-color: red;<br> left: 50%;<br> bottom: 48%;<br> transform: translateX(-50%);<br>}</pre><p>The #small-circle selector styles the small circle in the center of the clock face. It sets the position to absolute, the width and height to 20px, the border-radius to 50% to create a circular shape, and the background color to red. The left and bottom properties are set to 50% and 48% respectively to position the circle slightly above the center of the clock face. The transform property is used to horizontally center the circle.</p><pre>.container-2 {<br> display: flex;<br> position: absolute;<br> bottom: 44%;<br> left: 68%;<br> border: 2px solid black;<br> border-radius: 10px;<br> width: 80px;<br> height: 50px;<br> font-size: 1.3rem;<br>}<br>.container-2 #date {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> border-right: 1px solid black;<br> width: 40px;<br> height: 50px;<br> font-family: &#39;Trebuchet MS&#39;, &#39;Lucida Sans Unicode&#39;, &#39;Lucida Grande&#39;, &#39;Lucida Sans&#39;, Arial, sans-serif;<br>}<br>.container-2 #month {<br> display: flex;<br> justify-content: center;<br> align-items: center;<br> width: 40px;<br> height: 50px;<br> font-family: &#39;Trebuchet MS&#39;, &#39;Lucida Sans Unicode&#39;, &#39;Lucida Grande&#39;, &#39;Lucida Sans&#39;, Arial, sans-serif;<br>}</pre><p>These styles are applied to the container (container-2) that holds the date and month elements. It sets the container’s display to flex, positioning it absolutely within the clock face. The bottom and left properties are used to adjust the position. It has a border, border-radius, width, height, and font size defined. The #date and #month selectors style the individual date and month elements within the container, defining their display as flex, and centering the content horizontally and vertically using justify-content and align-items properties. The width, height, and font-family are also specified.</p><pre>.number1 {<br> transform: rotate(30deg);<br>}<br>.number2 {<br> transform: rotate(60deg);<br>}<br>.number3 {<br> transform: rotate(90deg);<br>}<br>.number4 {<br> transform: rotate(120deg);<br>}<br>.number5 {<br> transform: rotate(150deg);<br>}<br>.number6 {<br> transform: rotate(180deg);<br>}<br>.number7 {<br> transform: rotate(210deg);<br>}<br>.number8 {<br> transform: rotate(240deg);<br>}<br>.number9 {<br> transform: rotate(270deg);<br>}<br>.number10 {<br> transform: rotate(300deg);<br>}<br>.number11 {<br> transform: rotate(330deg);<br>}</pre><p>These styles apply rotation to each individual number element (number1 to number12). Each number is rotated to a specific angle using the transform property with the rotate() function.</p><p>That’s the breakdown of the CSS part. These styles define the appearance and positioning of the elements within the analog clock.</p><h3>Adding JavaScript Functionality</h3><p>Lastly, we’ll add JavaScript to make our analog clock functional. Create a new JavaScript file and name it `script.js`. Copy and paste the following JavaScript code into the file:</p><pre>const hourHand = document.querySelector(&quot;#hour-hand&quot;);<br>const minuteHand = document.querySelector(&quot;#minute-hand&quot;);<br>const secondHand = document.querySelector(&quot;#second-hand&quot;);<br>const date = document.querySelector(&quot;#date&quot;);<br>const month = document.querySelector(&quot;#month&quot;);<br>function setRotation(hand, rotation) {<br> hand.style.setProperty(&#39; - rotation&#39;, rotation);<br>}<br>function setClock() {<br> const currentDate = new Date();<br> const seconds = currentDate.getSeconds();<br> const minutes = currentDate.getMinutes();<br> const hours = currentDate.getHours();<br> const milliseconds = currentDate.getMilliseconds();<br>const secondsRotation = (seconds / 60) * 360 + (milliseconds / 1000) * 6;<br> const minutesRotation = ((minutes + seconds / 60) / 60) * 360;<br> const hoursRotation = ((hours + minutes / 60) / 12) * 360;<br>setRotation(secondHand, secondsRotation);<br> setRotation(minuteHand, minutesRotation);<br> setRotation(hourHand, hoursRotation);<br>date.textContent = currentDate.getDate();<br> month.textContent = currentDate.toLocaleString(&#39;default&#39;, { month: &#39;short&#39; });<br>}<br>setInterval(setClock, 10);</pre><p>Save the JavaScript file and link it to your HTML file by adding the following line before the closing &lt;/body&gt; tag of your HTML file:</p><pre>&lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;</pre><p>The JavaScript code above selects the clock hands and the date/month elements from the HTML, defines a setRotation() function to rotate the clock hands, and a setClock() function to update the clock’s time and date. The setInterval() function is used to continuously update the clock every 10 milliseconds.</p><h3>Javascript break down</h3><p>Certainly! Let’s break down the JavaScript part of the code step by step:</p><pre>const hourHand = document.querySelector(&quot;#hour-hand&quot;);<br>const minuteHand = document.querySelector(&quot;#minute-hand&quot;);<br>const secondHand = document.querySelector(&quot;#second-hand&quot;);<br>const date = document.querySelector(&quot;#date&quot;);<br>const month = document.querySelector(&quot;#month&quot;);</pre><p>In this section, we use the document.querySelector() method to select specific elements from the HTML document using their respective CSS selectors. The selected elements are assigned to variables for easy access and manipulation. We select the hour hand, minute hand, and second hand using their respective ids (#hour-hand, #minute-hand, #second-hand). We also select the date and month elements using their ids (#date, #month).</p><pre>function setRotation(hand, rotation) {<br> hand.style.setProperty(&#39; - rotation&#39;, rotation);<br>}</pre><p>This function, setRotation(), is responsible for setting the rotation of the clock hands. It takes two parameters: hand represents the specific clock hand element, and rotation is the rotation value that will be applied. The function uses the setProperty() method to set a CSS custom property (— rotation) on the hand element, which will be used to dynamically rotate the hand.</p><pre>function setClock() {<br> const currentDate = new Date();<br> const seconds = currentDate.getSeconds();<br> const minutes = currentDate.getMinutes();<br> const hours = currentDate.getHours();<br> const milliseconds = currentDate.getMilliseconds();<br>const secondsRotation = (seconds / 60) * 360 + (milliseconds / 1000) * 6;<br> const minutesRotation = ((minutes + seconds / 60) / 60) * 360;<br> const hoursRotation = ((hours + minutes / 60) / 12) * 360;<br>setRotation(secondHand, secondsRotation);<br> setRotation(minuteHand, minutesRotation);<br> setRotation(hourHand, hoursRotation);<br>date.textContent = currentDate.getDate();<br> month.textContent = currentDate.toLocaleString(&#39;default&#39;, { month: &#39;short&#39; });<br>}</pre><p>The setClock() function is responsible for updating the clock’s time and date. It starts by creating a currentDate object using the Date() constructor. It then retrieves the current seconds, minutes, hours, and milliseconds from the currentDate.</p><p>Next, it calculates the rotation values for the second hand, minute hand, and hour hand. The secondsRotation is calculated by dividing the current seconds by 60 to get a fraction, and multiplying it by 360 to convert it into degrees. The millisecondsare also considered by dividing them by 1000 and multiplying by 6 to add a smooth continuous motion. Similarly, the minutesRotation is calculated by considering the minutes and seconds, and the hoursRotation is calculated by considering the hours and minutes.</p><p>The setRotation() function is then called for each clock hand, passing in the hand element and the respective rotation value. This updates the rotation of the clock hands based on the current time.</p><p>Finally, the textContent property of the date and month elements is updated with the current date and month values respectively using <em>currentDate.getDate()</em> and currentDate.toLocaleString() methods.</p><pre>setInterval(setClock, 10);</pre><p>This line of code calls the setClock() function repeatedly every 10 milliseconds using the setInterval() method. This ensures that the clock’s time and rotation are continuously updated, creating a smooth ticking effect.</p><p>That’s the breakdown of the JavaScript part. It retrieves the current time, calculates the rotation values for the clock hands, updates their rotation using the setRotation() function, and updates the date and month elements on the clock face. The setClock() function is then called repeatedly to keep the clock in sync with the current time.</p><h3>Final Thoughts</h3><p>Congratulations! You have successfully created an analog clock using HTML, CSS, and JavaScript. By following this tutorial, you have learned how to structure the HTML, style the clock using CSS, and add functionality to the clock using JavaScript. Feel free to customize the styles and enhance the functionality to make it your own.</p><p>You can see the clock in action by opening the HTML file in your web browser. Have fun experimenting and incorporating this analog clock into your web projects!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32a254da8a9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Mathematical Breakdown of the Closed-Form Equation of Simple Linear Regression]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/a-mathematical-breakdown-of-the-closed-form-equation-of-simple-linear-regression-8f8306127900?source=rss-1369614bb5e2------2"><img src="https://cdn-images-1.medium.com/max/2600/1*x6wLCv0nxI43jhHWOkhwCw.jpeg" width="2992"></a></p><p class="medium-feed-snippet">A quick tour to strengthen your foundation in machine learning</p><p class="medium-feed-link"><a href="https://medium.com/data-science/a-mathematical-breakdown-of-the-closed-form-equation-of-simple-linear-regression-8f8306127900?source=rss-1369614bb5e2------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/a-mathematical-breakdown-of-the-closed-form-equation-of-simple-linear-regression-8f8306127900?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f8306127900</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[calculus]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Fri, 15 Jul 2022 04:37:18 GMT</pubDate>
            <atom:updated>2022-07-15T16:37:09.165Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Derive Mortgage Amortization Formula from Scratch]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/derive-mortgage-amortization-formula-from-scratch-7e61e0cba7f7?source=rss-1369614bb5e2------2"><img src="https://cdn-images-1.medium.com/max/1356/1*NJcPKgCq3aSS9ebIyOXsSA.png" width="1356"></a></p><p class="medium-feed-snippet">A Journey to Discover the Beauty of Math in Real Estates with the Visualization in Python</p><p class="medium-feed-link"><a href="https://medium.com/data-science/derive-mortgage-amortization-formula-from-scratch-7e61e0cba7f7?source=rss-1369614bb5e2------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/derive-mortgage-amortization-formula-from-scratch-7e61e0cba7f7?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e61e0cba7f7</guid>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[amortization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Sun, 25 Apr 2021 03:20:34 GMT</pubDate>
            <atom:updated>2021-04-25T04:25:18.241Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Creating Variable Factor Map (PCA) Plot with Python]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/principal-components-analysis-plot-for-python-311013a33cd9?source=rss-1369614bb5e2------2"><img src="https://cdn-images-1.medium.com/max/1320/1*hckR4920RoABauOmKDudLA.png" width="1320"></a></p><p class="medium-feed-snippet">In this tutorial I will show you how to create the Variable Factor Map using matplotlib step by step</p><p class="medium-feed-link"><a href="https://medium.com/data-science/principal-components-analysis-plot-for-python-311013a33cd9?source=rss-1369614bb5e2------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/principal-components-analysis-plot-for-python-311013a33cd9?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/311013a33cd9</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[apc]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Thu, 30 Jul 2020 18:24:18 GMT</pubDate>
            <atom:updated>2020-07-30T21:29:16.814Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Monty Hall Problem will drive you crazy]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/monty-hall-problem-will-drive-you-crazy-5bfeee84209e?source=rss-1369614bb5e2------2"><img src="https://cdn-images-1.medium.com/max/1372/1*zyYQdwsjfhToSuT8PTdx-w.png" width="1372"></a></p><p class="medium-feed-snippet">Solving the famous brain teaser by math, statistics, and Monte Carlo methods</p><p class="medium-feed-link"><a href="https://medium.com/data-science/monty-hall-problem-will-drive-you-crazy-5bfeee84209e?source=rss-1369614bb5e2------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/monty-hall-problem-will-drive-you-crazy-5bfeee84209e?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bfeee84209e</guid>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Wed, 01 Apr 2020 07:09:29 GMT</pubDate>
            <atom:updated>2020-04-01T15:37:59.967Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Decision Tree Fundamentals]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/decision-tree-fundamentals-388f57a60d2a?source=rss-1369614bb5e2------2"><img src="https://cdn-images-1.medium.com/max/2600/1*dHFJl1o0uAWgaVhGoEwxNQ.jpeg" width="5760"></a></p><p class="medium-feed-snippet">Learning about Gini Impurity, Entropy, and how to construct a decision tree</p><p class="medium-feed-link"><a href="https://medium.com/data-science/decision-tree-fundamentals-388f57a60d2a?source=rss-1369614bb5e2------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/decision-tree-fundamentals-388f57a60d2a?source=rss-1369614bb5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/388f57a60d2a</guid>
            <category><![CDATA[decision-tree]]></category>
            <category><![CDATA[gini-impurity]]></category>
            <category><![CDATA[entropy]]></category>
            <category><![CDATA[information-gain]]></category>
            <category><![CDATA[gini-index]]></category>
            <dc:creator><![CDATA[Huy Bui]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 05:13:46 GMT</pubDate>
            <atom:updated>2020-03-31T17:23:58.697Z</atom:updated>
        </item>
    </channel>
</rss>