【Leetcode_easy】949. Largest Time for Given Digits
problem
949. Largest Time for Given Digits
solution:
class Solution {
public:
string largestTimeFromDigits(vector<int>& A) {
sort(A.begin(), A.end(), greater<int>());//errr..largest..
do
{
if((A[]< || (A[]==&&A[]<)) && A[]<)//err..
{
return to_string(A[])+to_string(A[])+":"+to_string(A[])+to_string(A[]);//err.
}
}
while(prev_permutation(A.begin(), A.end()));//err..
return "";
}
};
参考
1. Leetcode_easy_949. Largest Time for Given Digits;
2. discuss;
3. cplusplus_prev_permutation;
4. cplusplus_sort;
完
【Leetcode_easy】949. Largest Time for Given Digits的更多相关文章
- 【leetcode】949. Largest Time for Given Digits
题目如下: Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 ...
- 【LeetCode】949. Largest Time for Given Digits 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...
- 【Leetcode_easy】976. Largest Perimeter Triangle
problem 976. Largest Perimeter Triangle solution: class Solution { public: int largestPerimeter(vect ...
- 【Leetcode_easy】812. Largest Triangle Area
problem 812. Largest Triangle Area solution: class Solution { public: double largestTriangleArea(vec ...
- 【Leetcode_easy】747. Largest Number At Least Twice of Others
problem 747. Largest Number At Least Twice of Others 题意: solution1: class Solution { public: int dom ...
- 【LeetCode】764. Largest Plus Sign 解题报告(Python)
[LeetCode]764. Largest Plus Sign 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn ...
- 【LeetCode】813. Largest Sum of Averages 解题报告(Python)
[LeetCode]813. Largest Sum of Averages 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博 ...
- 【Leetcode_easy】703. Kth Largest Element in a Stream
problem 703. Kth Largest Element in a Stream 题意: solution1: priority_queue这个类型没有看明白... class KthLarg ...
- 【leetcode】Kth Largest Element in an Array (middle)☆
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the so ...
随机推荐
- BasicAuth
Go实现 在头里设置WWW-Authenticate 返回401 func (webhandler) ServeHTTP(writer http.ResponseWriter, request *ht ...
- 深入了解js函数
<script> //深入了解函数1.函数参数:2.函数的返回值:3. 变量的作用域:4.自调用函数 //函数的定义 function test(){ console.log(" ...
- learning armbian steps(3) ----- armbian 文件系统定制思路
如何定制自已的armbian文件系统. 1)uboot 2) kernel 3) rootfs 针对linux 系统开发人员来说,真正有用的只是其armbian文件系统, 将其制作成所需的文件系统 ...
- jdango 2.x的url配置的改变
新版本的url.py文件中,不在使用1.x的正则表达式,强制使用在程序启动的时候会提示: WARNINGS: ?: (2_0.W001) Your URL pattern '^*article/' h ...
- C 指针常量 和常量指针 指向常量的指针常量的使用
#include <stdio.h> /* 指针常量 和常量指针 指向常量的指针常量 */ int main() { int a = 100; int b =200; int* const ...
- UOJ272. 【清华集训2016】石家庄的工人阶级队伍比较坚强 [FWT]
UOJ 思路 很容易想到\(O(3^{3m}\log T)\)的暴力大矩乘,显然过不了. 我们分析一下每次转移的性质.题目给的转移方程是填表法,我们试着改成刷表法看看-- 发现好像没啥用. 注意到游戏 ...
- navicat 链接阿里云服务器数据库报80070007 的错误
navicat用ssh跳转登录mysql连接时报: 80070007: SSH Tunnel: Server does not support diffie-hellman-group1-sha1 f ...
- C语言scanf函数返回值小记
scanf scanf是C标准库stdio里面定义的用于获取用户输入的函数,具体的介绍可以在CppReference上看到.scanf的返回值是已经成功赋值的变量个数,也就是说在 scanf(&quo ...
- Mysql插入多条数据测试
--新建存储过程 create procedure doinsert3() begin declare i int; declare j int; set i = 0; set j = 0; whil ...
- 设置windows service方式启动GitBlit
1.在Gitblit目录下,找到installService.cmd文件. 2.用记事本或者notepad++打开 2.1修改 ARCH 32位系统:SET ARCH=x86 64位系统:SET AR ...