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 request B.

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**相关推荐

  1. leetcode 825. Friends Of Appropriate Ages

    leetcode 825. Friends Of Appropriate Ages 原题地址:https://leetcode.com/problems/friends-of-appropriate- ...

  2. LeetCode 825 Friends Of Appropriate Ages

    LeetCode 825 Friends Of Appropriate Ages 传送门 题目分析 Some people will make friend requests. The list of ...

  3. 【LeetCode】825. Friends Of Appropriate Ages 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/friends-o ...

  4. 【Leetcode】825. Friends Of Appropriate Ages

    题目地址: https://leetcode.com/problems/friends-of-appropriate-ages/ 给定nnn个人的年龄,当满足以下要求的时候aaa不会给bbb发消息: ...

  5. LeetCode All in One 题目讲解汇总(持续更新中...)

    原文地址:https://www.cnblogs.com/grandyang/p/4606334.html 终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开 ...

  6. LeetCode 825 friends-of-appropriate-ages

    LeetCode 825 仔细分析一下条件: age[B] <= 0.5 * age[A] + 7 age[B] > age[A] age[B] > 100 && a ...

  7. leetcode每日一题825. 适龄的朋友 快排+双指针

    本文目录 leetcode每日一题825. 适龄的朋友 快排+双指针 写在前面 题目 示例 提示 思路 代码实现 执行结果 写在后面 leetcode每日一题825. 适龄的朋友 快排+双指针 写在前 ...

  8. 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 ...

  9. 825. 适龄的朋友

    适龄的朋友 在社交媒体网站上有 n 个用户.给你一个整数数组 ages ,其中 ages[i] 是第 i 个用户的年龄. 如果下述任意一个条件为真,那么用户 x 将不会向用户 y(x != y)发送好 ...

最新文章

  1. 下面的语言中哪些语言是动态语言( )
  2. Java编程思想 (1~10)
  3. ios kvo 要引入_iOS KVO 实现原理 和 自己实现KVO
  4. mysql 8.0以上 新版本账号密码策略修改和密码修改
  5. PAT 1013 数素数
  6. 2018.12.2 中国石油大学第一次新生训练赛题解
  7. 纽微特纪事:吾是如何被架空的(各位引以为戒)
  8. python turtle画小狗_python-turtle-画雪花
  9. linux卸载邮件服务,Zimbra在linux系统上的删除(卸载)方法
  10. 基于Flink建设流批一体实时数仓
  11. Android/安卓 文本添加中划线、下划线的方法
  12. 蓝牙 4.0 ATT属性协议
  13. Mybatis 批量插入数据 SQL
  14. 深度学习模型的训练(大总结)
  15. 转:旅游推荐系统的演进
  16. 极客 android,一款开源的Android极客应用(来一起学习kotlin)
  17. 朱嘉明:产业周期、科技周期与金融周期的失衡
  18. 用Chrome插件实现网页数据统计功能
  19. 【tkinter】的使用详解,做一个简单实用的万能可视化界面!
  20. C语言复习笔记——适合一些需要复习和进阶c语言的朋友,这只能说是个概要。当然,如果朋友你看到某个内容能联想到知识点,那你应该是掌握了的,你可以尝试找找其他的文章去深入理解下,如有错误和疑问可以直接指出

热门文章

  1. 《星际争霸》单位语音中英文完全版
  2. java计算机毕业设计小学教师课程管理系统源程序+mysql+系统+lw文档+远程调试
  3. JAVA计算机毕业设计租房管理系统Mybatis+系统+数据库+调试部署
  4. 魔兽巨龙追猎者服务器微信群,魔兽世界怀旧服开门情况一览,60多个区已缴满...
  5. English - therefore,so,hence,then,accordingly,thus用法解析
  6. global.fun.php
  7. 一朵云开启智慧交通新未来
  8. VLOOKUP命令不生效的坑
  9. HTML之 <p></p>标签 笔记
  10. 中国婚博会PHP高级工程师、安全顾问汤青松:浅析Web安全编程