Skip to content

Instantly share code, notes, and snippets.

View heemoe's full-sized avatar
🎅
Happy coding

Huangxi heemoe

🎅
Happy coding
View GitHub Profile
class javachallenge {
public static int[] rotate(int[] arr) {
int k = 2;
int[] nums = arr;
int length = nums.length;
int left = length - (k % length);
int right = k % length;
int[] newArr = new int[length];
class javachallenge {
public static boolean check(char[] password) {
// Enter your code here
boolean haveDigits = false;
boolean haveLetter = false;
if (password.length >= 8) {
for (int i = 0; i < password.length; i ++) {
if (Character.isDigit(password[i])) {
import java.util.ArrayList;
import java.util.List;
class javachallenge {
public static boolean ugly(int number) {
if (number == 1) return true;
int n = number;
List<Integer> factors = new ArrayList<Integer>();
for (int i = 2; i <= n; i++) {
while (n % i == 0) {
@heemoe
heemoe / custom_switch.dart
Created December 7, 2021 18:19
flutter custom text switch controller
import 'package:flutter/material.dart';
class CustomSwitch extends StatefulWidget {
const CustomSwitch(
{Key? key, required this.leftStr, required this.rightStr, this.onChange})
: super(key: key);
final String leftStr;
final String rightStr;
final Function(int selected)? onChange;
@heemoe
heemoe / hosts2zonefile.py
Created January 18, 2017 12:19
一个将hosts文件转换成bind9 zone文件的脚本
#!/usr/bin/python3
import re
import datetime
import os
#download hosts file path.
hostsFile="hosts"
#zone file save path.
outputZoneFile="hosts.zone"
#target named zone file path
targetZoneFile="/usr/local/named/var/rpz.zone"