825. Friends Of Appropriate Ages**
825. Friends Of Appropriate Ages**
https://leetcode.com/problems/friends-of-appropriate-ages/
题目描述
Some people will make friend requests. The list of their ages is given and ages[i]
is the age of the ith
person.
Person A
will NOT friend request person B
(B
!= A
) if any of the following conditions are true:
age[B] <= 0.5 * age[A] + 7
age[B] > age[A]
age[B] > 100 && age[A] < 100
Otherwise,A
will friend requestB
.
Note that if A
requests B
, B
does not necessarily request A
. Also, people will not friend request themselves.
How many total friend requests are made?
Example 1:
Input: [16,16]
Output: 2
Explanation: 2 people friend request each other.
Example 2:
Input: [16,17,18]
Output: 2
Explanation: Friend requests are made 17 -> 16, 18 -> 17.
Example 3:
Input: [20,30,100,110,120]
Output:
Explanation: Friend requests are made 110 -> 100, 120 -> 110, 120 -> 100.
Notes:
1 <= ages.length <= 20000
.1 <= ages[i] <= 120
.
前言
有个笑话, 我必须笑一下:
因为我在写代码的过程中也发现了这个问题, 然后停下来开始怀疑了人生 …
825. Friends Of Appropriate Ages**相关推荐
- leetcode 825. Friends Of Appropriate Ages
leetcode 825. Friends Of Appropriate Ages 原题地址:https://leetcode.com/problems/friends-of-appropriate- ...
- LeetCode 825 Friends Of Appropriate Ages
LeetCode 825 Friends Of Appropriate Ages 传送门 题目分析 Some people will make friend requests. The list of ...
- 【LeetCode】825. Friends Of Appropriate Ages 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/friends-o ...
- 【Leetcode】825. Friends Of Appropriate Ages
题目地址: https://leetcode.com/problems/friends-of-appropriate-ages/ 给定nnn个人的年龄,当满足以下要求的时候aaa不会给bbb发消息: ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
原文地址:https://www.cnblogs.com/grandyang/p/4606334.html 终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开 ...
- LeetCode 825 friends-of-appropriate-ages
LeetCode 825 仔细分析一下条件: age[B] <= 0.5 * age[A] + 7 age[B] > age[A] age[B] > 100 && a ...
- leetcode每日一题825. 适龄的朋友 快排+双指针
本文目录 leetcode每日一题825. 适龄的朋友 快排+双指针 写在前面 题目 示例 提示 思路 代码实现 执行结果 写在后面 leetcode每日一题825. 适龄的朋友 快排+双指针 写在前 ...
- avisynth_c.h:825:3: error: unknown type name ‘HMODULE’
avisynth_c.h:825:3: error: unknown type name 'HMODULE' In file included from input/avs.c:49:0: ./ext ...
- 825. 适龄的朋友
适龄的朋友 在社交媒体网站上有 n 个用户.给你一个整数数组 ages ,其中 ages[i] 是第 i 个用户的年龄. 如果下述任意一个条件为真,那么用户 x 将不会向用户 y(x != y)发送好 ...
最新文章
- 下面的语言中哪些语言是动态语言( )
- Java编程思想 (1~10)
- ios kvo 要引入_iOS KVO 实现原理 和 自己实现KVO
- mysql 8.0以上 新版本账号密码策略修改和密码修改
- PAT 1013 数素数
- 2018.12.2 中国石油大学第一次新生训练赛题解
- 纽微特纪事:吾是如何被架空的(各位引以为戒)
- python turtle画小狗_python-turtle-画雪花
- linux卸载邮件服务,Zimbra在linux系统上的删除(卸载)方法
- 基于Flink建设流批一体实时数仓
- Android/安卓 文本添加中划线、下划线的方法
- 蓝牙 4.0 ATT属性协议
- Mybatis 批量插入数据 SQL
- 深度学习模型的训练(大总结)
- 转:旅游推荐系统的演进
- 极客 android,一款开源的Android极客应用(来一起学习kotlin)
- 朱嘉明:产业周期、科技周期与金融周期的失衡
- 用Chrome插件实现网页数据统计功能
- 【tkinter】的使用详解,做一个简单实用的万能可视化界面!
- C语言复习笔记——适合一些需要复习和进阶c语言的朋友,这只能说是个概要。当然,如果朋友你看到某个内容能联想到知识点,那你应该是掌握了的,你可以尝试找找其他的文章去深入理解下,如有错误和疑问可以直接指出
热门文章
- 《星际争霸》单位语音中英文完全版
- java计算机毕业设计小学教师课程管理系统源程序+mysql+系统+lw文档+远程调试
- JAVA计算机毕业设计租房管理系统Mybatis+系统+数据库+调试部署
- 魔兽巨龙追猎者服务器微信群,魔兽世界怀旧服开门情况一览,60多个区已缴满...
- English - therefore,so,hence,then,accordingly,thus用法解析
- global.fun.php
- 一朵云开启智慧交通新未来
- VLOOKUP命令不生效的坑
- HTML之 <p></p>标签 笔记
- 中国婚博会PHP高级工程师、安全顾问汤青松:浅析Web安全编程