自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 brew services start httpd 出错

brew services start httpd失败

2023-05-15 12:19:44 427 1

原创 brew services start httpd failed

opt/homebrew/var/log/httpd/ 目录下有error_log, access_log.unload homebrew.mxcl.httpd.plist后,再load它,然后再启动httpd,失败。brew services start httpd抛出异常。以上的每一个方案都有成功案例,但是对我都无济于事。后重新安装httpd,再启动httpd。error_log里的log信息是。后再start httpd,失败。直接重新安装httpd。mac m1 机器。感觉没什么有效信息。

2023-05-15 12:01:20 143

原创 sql: 取出满足同时有a和b两个数据,且a发生的时间大于b的数据。

希望取出同时选择了course1和course3,并且选course1的最小的changed_time比选course3 最小的changed_time小。但是jack和lily的course1 的最小changed_time小于course3的最小changed time。jack,tony,lily都是又选了course1,又选了course3的。取出表中column x中同时有a和b,并且a发生时间大于b的数据。

2023-04-27 15:08:04 592 1

原创 sql 筛选分组里同时满足有某值以及没另一值

tony的class为1,3,满足有1,没有2。比如: jack 的class 为1,2,3. 不符合。想要筛选出所有class为1,但是没有2的学生。

2023-04-26 17:48:54 597

原创 restful生成swagger文档

springboot项目自动生成swagger文档

2023-02-09 13:56:22 67 1

原创 Indeed修改数组行或者列,得到最大数组和

输入H,W,X,Kint[H][W]H代表行,W代表列,X代表要替换成的数字,k代表要替换多少行或者列(替换的行列数之和可以小于K).输出:各种替换可能中,数组的最大和。例子:输入:882914-89 -76 92 61 5 -18 -68 90-3 44 -9 84 -36 51 -43 8511 -72 5 -90 -43 -94

2015-11-02 15:39:10 453

原创 循环数组左移

给定一个数组,左移k位。这一题,我开始是这样考虑的,每一位都应该直接移动到 (i-k+n)%n位。所以代码如下:import java.util.Scanner;public class Reverse { public String solve(char[] c, int k) { int i = 0; char temp = c[i]; int n = c.

2015-11-01 20:30:19 890

原创 Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.这一题好难啊。一点头绪都没有,要求是线性时间复杂度,同时要求常数项空间。答案上,是这样来的。使用了位运算。ps:感觉用到位运算的题目都好难。如果对所有数字的第i位bit进行统计的话,会发

2015-10-30 22:51:23 261

原创 Single Number

Given an array of integers, every element appears twice except for one. Find that single one.这一题第一反应是 直接存个map,作为键值对。但是这一题要求 不要有extra memory,同时时间复杂度为O(n);直接想到异或^,两个数相异为1,相同为0。所以把数组整个异或一遍,出来的值就是

2015-10-30 21:36:01 236

原创 Binary Tree Upside Down

Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the origin

2015-10-30 20:14:31 307

原创 Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The

2015-10-29 21:26:34 546

原创 Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.和上一题不同的地方就在于这一题是sorted list 上一题是 sorted array比较无耻点,其实可以直接仿照之前的sorted array的方法:代码如下(有问

2015-10-29 20:18:06 257

原创 Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

2015-10-29 20:10:34 291

原创 Balanced Binary Tree

Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

2015-10-28 17:02:55 257

原创 Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.一开始的考虑很有问题,忘了考虑是到结点(左右子树都为空)的路径,所以

2015-10-28 16:36:22 238

原创 Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.这一题很简单,就什么都不多说了。数的高度等于子树的高度(

2015-10-28 16:32:53 256

原创 Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th

2015-10-28 16:07:45 274

原创 Copy List with Random Pointer

题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.不要想的太复杂了。直接用个hash

2015-10-27 21:37:40 296

原创 Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.这题一开始一直TLE。后来查了下,发现是因为/** * Definition for singly-linked list. * public class ListNode { *

2015-10-27 20:59:15 260

原创 atoi

leetcode50题String to Integer的实现

2015-10-01 23:56:12 265

原创 计数排序的 java实现

import java.util.Scanner;//对每一个输入元素x,确定小于x的元素个数。利用这一信息,直接把x放到它在输出数组中的位置上。public class CountingSort {int k;public static int[] sort(int[] A, int k) {int[] C = new int[k+1]; //辅助数组,数

2014-07-26 11:37:08 378

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除