继续过Hard题目.周五

 

 #TitleEditorialAcceptanceDifficultyFrequency 
 。65Valid Number   12.6%Hard 
 。126Word Ladder II   13.6%Hard 
 。149Max Points on a Line   15.6%Hard 
 。146LRU Cache   16.0%Hard 
 。68Text Justification   18.1%Hard 
 。460LFU Cache   19.0%Hard 
 。44Wildcard Matching   19.0%Hard 
 。308Range Sum Query 2D - Mutable   19.8%Hard 
 。4Median of Two Sorted Arrays   20.8%Hard 
 。420Strong Password Checker   21.0%Hard 
 。273Integer to English Words   21.1%Hard 
 。30Substring with Concatenation of All Words   21.7%Hard 
 。440K-th Smallest in Lexicographical Order   22.1%Hard 
 。140Word Break II   22.2%Hard 
 。212Word Search II   22.2%Hard 
 。269Alien Dictionary   22.3%Hard 
 。174Dungeon Game   22.9%Hard 
 。214Shortest Palindrome   23.0%Hard 
 。446Arithmetic Slices II - Subsequence   23.0%Hard 
 。32Longest Valid Parentheses   23.1%Hard 
 。295Find Median from Data Stream   23.3%Hard 
 。132Palindrome Partitioning II   23.4%Hard 
 。10Regular Expression Matching   23.6%Hard 
 。76Minimum Window Substring   23.8%Hard 
 。188Best Time to Buy and Sell Stock IV   23.8%Hard 
 。321Create Maximum Number   23.9%Hard 
 。135Candy   23.9%Hard 
 。335Self Crossing   23.9%Hard 
 。97Interleaving String   23.9%Hard 
 。391Perfect Rectangle   24.2%Hard 
 。158Read N Characters Given Read4 II - Call multiple times   24.4%Hard 
 。466Count The Repetitions   24.6%Hard 
 。336Palindrome Pairs   24.7%Hard 
 。41First Missing Positive   24.9%Hard 
 。124Binary Tree Maximum Path Sum   25.0%Hard 
 。224Basic Calculator   25.5%Hard 
 。218The Skyline Problem   25.5%Hard 
 。84Largest Rectangle in Histogram   25.6%Hard 
 。23Merge k Sorted Lists   25.9%Hard 
 。45Jump Game II   26.0%Hard 
 。85Maximal Rectangle   26.1%Hard 
 。57Insert Interval   26.3%Hard 
 。138Copy List with Random Pointer   26.6%Hard 
 。233Number of Digit One   27.3%Hard 
 。381Insert Delete GetRandom O(1) - Duplicates allowed   28.0%Hard 
 。37Sudoku Solver   28.1%Hard 
 。432All O`one Data Structure   28.2%Hard 
 。87Scramble String   28.3%Hard 
 。123Best Time to Buy and Sell Stock III   28.3%Hard 
 。56Merge Intervals   28.4%Hard 
 。282Expression Add Operators   28.5%Hard 
 。316Remove Duplicate Letters   28.6%Hard 
 164Maximum Gap   28.6%Hard 
 99Recover Binary Search Tree   28.7%Hard 
 327Count of Range Sum   28.9%Hard 
 51N-Queens   29.0%Hard 
 25Reverse Nodes in k-Group   29.7%Hard 
 472Concatenated Words   30.1%Hard 
 465Optimal Account Balancing   30.1%Hard 
 248Strobogrammatic Number III   30.5%Hard 
 72Edit Distance   30.6%Hard 
 115Distinct Subsequences   30.6%Hard 
 403Frog Jump   30.9%Hard 
 411Minimum Unique Word Abbreviation   31.1%Hard 
 239Sliding Window Maximum   31.4%Hard 
 330Patching Array   31.5%Hard 
 297Serialize and Deserialize Binary Tree   31.6%Hard 
 354Russian Doll Envelopes   31.8%Hard 
 358Rearrange String k Distance Apart   31.8%Hard 
 33Search in Rotated Sorted Array   31.9%Hard 
 363Max Sum of Rectangle No Larger Than K   32.1%Hard 
 410Split Array Largest Sum   32.2%Hard 
 480Sliding Window Median   33.1%Hard 
 317Shortest Distance from All Buildings   33.3%Hard 
 117Populating Next Right Pointers in Each Node II   33.5%Hard 
 315Count of Smaller Numbers After Self   33.5%Hard 
 301Remove Invalid Parentheses   34.5%Hard 
 42Trapping Rain Water   35.3%Hard 
 128Longest Consecutive Sequence   35.3%Hard 
 329Longest Increasing Path in a Matrix   35.4%Hard 
 407Trapping Rain Water II   35.6%Hard 
 154Find Minimum in Rotated Sorted Array II   36.2%Hard 
 265Paint House II   37.1%Hard 
 272Closest Binary Search Tree Value II   37.6%Hard 
 291Word Pattern II   37.7%Hard 
 305Number of Islands II   38.1%Hard 
 380Insert Delete GetRandom O(1)   38.4%Hard 
 145Binary Tree Postorder Traversal   38.4%Hard 
 340Longest Substring with At Most K Distinct Characters   38.6%Hard 
 352Data Stream as Disjoint Intervals   38.9%Hard 
 159Longest Substring with At Most Two Distinct Characters   39.7%Hard 
 312Burst Balloons   41.6%Hard 
 287Find the Duplicate Number   41.8%Hard 
 425Word Squares   41.9%Hard 
 52N-Queens II   42.8%Hard 
 302Smallest Rectangle Enclosing Black Pixels   44.0%Hard 
 471Encode String with Shortest Length   44.2%Hard 
 296Best Meeting Point   50.4%Hard

 

 。45Jump Game II   26.0%Hard

很好的题目。

https://discuss.leetcode.com/topic/3191/o-n-bfs-solution/2

 

85Maximal Rectangle   26.1%Hard

这个解法真的是相当的好。

https://discuss.leetcode.com/topic/6650/share-my-dp-solution/2

 

233Number of Digit One   27.3%Hard

这个解法非常好,也非常有技巧:

https://discuss.leetcode.com/topic/18054/4-lines-o-log-n-c-java-python

通过对某一个位置上面的1的个数累加,来完成。

 

 

57Insert Interval   26.3%Hard

解法非常好。

http://www.cnblogs.com/charlesblc/p/6438698.html

 

37Sudoku Solver   28.1%Hard

很好的解法:

https://discuss.leetcode.com/topic/11327/straight-forward-java-solution-using-backtracking

 

432All O`one Data Structure   28.2%Hard

我也有大致的思路。这个里面的代码写的真是非常的精巧。

https://discuss.leetcode.com/topic/63827/c-solution-with-comments

class AllOne {
public:

    void inc(string key) {
        
        // If the key doesn't exist, insert it with value 0.
        if (!bucketOfKey.count(key))
            bucketOfKey[key] = buckets.insert(buckets.begin(), {0, {key}});
            
        // Insert the key in next bucket and update the lookup.
        auto next = bucketOfKey[key], bucket = next++;
        if (next == buckets.end() || next->value > bucket->value + 1)
            next = buckets.insert(next, {bucket->value + 1, {}});
        next->keys.insert(key);
        bucketOfKey[key] = next;
        
        // Remove the key from its old bucket.
        bucket->keys.erase(key);
        if (bucket->keys.empty())
            buckets.erase(bucket);
    }

    void dec(string key) {

        // If the key doesn't exist, just leave.
        if (!bucketOfKey.count(key))
            return;

        // Maybe insert the key in previous bucket and update the lookup.
        auto prev = bucketOfKey[key], bucket = prev--;
        bucketOfKey.erase(key);
        if (bucket->value > 1) {
            if (bucket == buckets.begin() || prev->value < bucket->value - 1)
                prev = buckets.insert(bucket, {bucket->value - 1, {}});
            prev->keys.insert(key);
            bucketOfKey[key] = prev;
        }
        
        // Remove the key from its old bucket.
        bucket->keys.erase(key);
        if (bucket->keys.empty())
            buckets.erase(bucket);
    }

    string getMaxKey() {
        return buckets.empty() ? "" : *(buckets.rbegin()->keys.begin());
    }
    
    string getMinKey() {
        return buckets.empty() ? "" : *(buckets.begin()->keys.begin());
    }

private:
    struct Bucket { int value; unordered_set<string> keys; };
    list<Bucket> buckets;
    unordered_map<string, list<Bucket>::iterator> bucketOfKey;
};
View Code

很不错。用了stl里面的list,然后用了里面的iterator,可以方便的++,--,insert和erase。

 

转载于:https://www.cnblogs.com/charlesblc/p/6437493.html

资源下载链接为: https://pan.quark.cn/s/9648a1f24758 这个HTML文件是一个专门设计的网页,适合在告白或纪念日这样的特殊时刻送给女朋友,给她带来惊喜。它通过HTML技术,将普通文字转化为富有情感和创意的表达方式,让数字媒体也能传递深情。HTML(HyperText Markup Language)是构建网页的基础语言,通过标签描述网页结构和内容,让浏览器正确展示页面。在这个特效网页中,开发者可能使用了HTML5的新特性,比如音频、视频、Canvas画布或WebGL图形,来提升视觉效果和交互体验。 原本这个文件可能是基于ASP.NET技术构建的,其扩展名是“.aspx”。ASP.NET是微软开发的一个服务器端Web应用程序框架,支持多种编程语言(如C#或VB.NET)来编写动态网页。但为了在本地直接运行,不依赖服务器,开发者将其转换为纯静态的HTML格式,只需浏览器即可打开查看。 在使用这个HTML特效页时,建议使用Internet Explorer(IE)浏览器,因为一些老的或特定的网页特效可能只在IE上表现正常,尤其是那些依赖ActiveX控件或IE特有功能的页面。不过,由于IE逐渐被淘汰,现代网页可能不再对其进行优化,因此在其他现代浏览器上运行可能会出现问题。 压缩包内的文件“yangyisen0713-7561403-biaobai(html版本)_1598430618”是经过压缩的HTML文件,可能包含图片、CSS样式表和JavaScript脚本等资源。用户需要先解压,然后在浏览器中打开HTML文件,就能看到预设的告白或纪念日特效。 这个项目展示了HTML作为动态和互动内容载体的强大能力,也提醒我们,尽管技术在进步,但有时复古的方式(如使用IE浏览器)仍能唤起怀旧之情。在准备类似的个性化礼物时,掌握基本的HTML和网页制作技巧非常
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值