![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
文章平均质量分 59
数据结构与算法
开源字节
致力于企业智能管理软件的策划、定制与研发
展开
-
负载均衡算法
本文主要介绍常用的负载均衡算法和Nginx中支持的负载均衡算法。原创 2022-08-25 21:33:54 · 198 阅读 · 0 评论 -
ListNode链表 两数之和
自定义的ListNode链表类如下:package leetcode.editor.cn;public class ListNode { int val; ListNode next; ListNode(int x){ val =x; }}解法如下:package leetcode.editor.cn;public class AddTwoNumbers { public static void main(String[] ar原创 2022-01-14 13:54:55 · 256 阅读 · 0 评论 -
整数反转及问题解析
解题思路:首先我们想一下,怎么去反转一个整数?用栈?或者把整数变成字符串,再去反转这个字符串?这两种方式是可以,但并不好。实际上我们只要能拿到这个整数的末尾数字就可以了。以12345为例,先拿到5,再拿到4,之后是3,2,1,我们按这样的顺序就可以反向拼接处一个数字了,也就能达到反转的效果。怎么拿末尾数字呢?好办,用取模运算就可以了1、将12345 % 10得到5,之后将12345 / 102、将1234 % 10得到4,再将1234 / 103、将123 % 10得...原创 2021-11-30 16:36:48 · 116 阅读 · 0 评论 -
idea运行leetcode报错
错误信息:Line 1: error: class, interface, or enum expected [in TwoSum.java]看到这个错误信息没?相信我,你找对了地方!一直想解算法,奈何idea大哥一直报错,辗转反侧很久,各种原因排查,都不对,反正就是一直报错。偶然发现两句关键的代码// leetcode submit region begin(Prohibit modification and deletion)// leetcode submit region end(P原创 2021-11-19 17:37:15 · 1642 阅读 · 2 评论 -
两数之和及问题解析
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2, 7, 11, 15...原创 2021-08-23 13:34:08 · 85 阅读 · 0 评论