TinaCristal's Blog


  • Home

  • Tags

  • Categories

  • Archives

  • Search

CCF201509-2 日期计算

Posted on 2018-11-26 | In ccf认证

问题描述
  给定一个年份y和一个整数d,问这一年的第d天是几月几日?

注意闰年的2月有29天。满足下面条件之一的是闰年:

1) 年份是4的整数倍,而且不是100的整数倍;

2) 年份是400的整数倍。

Read more »

getline使用

Posted on 2018-11-26 | In c++

getline()函数是一个比较常见的函数。根据名字直接”望文->生义”,就知道这个函数是来完成读入一行数据。

Read more »

C/C++各种类型的快速初始化

Posted on 2018-11-26 | In c++

数组的初始化
普通的数组可以使用大括号来初始化,且这个大括号是可以嵌套使用的:

Read more »

Leetcode 126. Word Ladder II

Posted on 2018-11-26 | In leetcode

Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:

Read more »

Leetcode 680. Valid Palindrome II

Posted on 2018-11-25 | In leetcode

Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.

Read more »

c++ unique_ptr

Posted on 2018-11-25 | In c++

`
我们知道auto_ptr通过复制构造或者通过=赋值后,原来的auto_ptr对象就报废了.所有权转移到新的对象中去了.而通过shared_ptr可以让多个智能指针对象同时拥有某一块内存的访问权.但假如我们不希望多个内存块被多个智能指针对象共享,同时又不会像auto_ptr那样不知不觉的就让原来的auto_ptr对象失效,可咋整呢?

Read more »

745. Prefix and Suffix Search

Posted on 2018-11-25 | In leetcode

Given many words, words[i] has weight i.

Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix). It will return the word with given prefix and suffix with maximum weight. If no word exists, return -1.

Read more »

Leetcode 726. Number of Atoms

Posted on 2018-11-25 | In leetcode

Given a chemical formula (given as a string), return the count of each atom.

An atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.

1 or more digits representing the count of that element may follow if the count is greater than 1. If the count is 1, no digits will follow. For example, H2O and H2O2 are possible, but H1O2 is impossible.

Read more »

Leetcode 720. Longest Word in Dictionary

Posted on 2018-11-25 | In leetcode

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest lexicographical order.

Read more »

Leetcode 72. Edit Distance

Posted on 2018-11-25 | In leetcode

Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.

Read more »

1…222324…45

TinaCristal

443 posts
57 categories
55 tags
GitHub E-Mail
© 2020 TinaCristal
Powered by Hexo
|
Theme — NexT.Mist v5.1.4