随笔分类 -  数据结构

摘要:Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume t 阅读全文
posted @ 2021-12-16 13:12 啤酒加点醋 阅读(16) 评论(0) 推荐(0) 编辑
摘要:A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings 阅读全文
posted @ 2021-12-15 15:03 啤酒加点醋 阅读(23) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linea 阅读全文
posted @ 2021-12-14 22:04 啤酒加点醋 阅读(25) 评论(0) 推荐(0) 编辑
摘要:给定一个整数数组,判断是否存在重复元素。 如果存在一值在数组中出现至少两次,函数返回 true 。如果数组中每个元素都不相同,则返回 false 。 题解一:双循环 class Solution { public boolean containsDuplicate(int[] nums) { for 阅读全文
posted @ 2021-12-12 15:31 啤酒加点醋 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示