
【编程】
circujoker_06
hello world
展开
-
【编程】【2017京东java实习生编程题】拍卖
题目:http://exercise.acmcoder.com/online/online_judge_ques?ques_id=4398&konwledgeId=41package com.smart.reflect;/** * 第一点:最终的定价肯定是某个客户的出价 * 第二点:将客户的价格从高到底排序 然后计算出用户数量乘以价格的最大值 返回价格 * */impor原创 2017-04-08 23:19:50 · 511 阅读 · 0 评论 -
【编程】【leetcode】125.Valid Palindrome
125 Valid Palindrome//判断一个字符是否是数字或者是字符package Test;import java.lang.*;public class Test01 { public static void main(String[] args) { // create 2 int primitives cp1, cp2 int cp1, cp2;原创 2017-04-05 22:23:43 · 454 阅读 · 0 评论 -
【编程】【leetcode】345.Reverse Vowels of a String
c++//// string::find_first_of//#include // std::cout//#include // std::string//#include // std::size_t////int main()//{// std::string str("Please, replace the vowels i原创 2017-04-05 21:47:05 · 472 阅读 · 0 评论 -
【编程】【leetcode】344. Reverse String
1.字符编码//字节和字符的区别 http://jiapumin.iteye.com/blog/1006144 getBytes和操作系统编码格式相关联的import java.io.UnsupportedEncodingException;public class Test01 { public static void main(String[] args) throw原创 2017-04-05 19:38:17 · 319 阅读 · 0 评论 -
【编程】【leetcode】186.Reverse Words in a String II
思路:方法一:先把每个单词反转,再讲整个字符串反转。方法二:和151的解决一样,利用内置函数+正则表达式 (其实152就是151的简化版本)class Solution {public: void reverseWords(string &s) { int left = 0; for (int i = 0; i <= s.size(); ++原创 2017-04-05 21:00:05 · 574 阅读 · 0 评论 -
【编程】【leetcode】151. Reverse Words in a String
/** \\d表示 0-9 的数字, \\s表示 空格,回车,换行等空白符, \\w表示单词字符(数字字母下划线) +号表示一个或多个 * */ class Solution { public String reverseWords(String s) { String[] parts = s.tri原创 2017-04-05 20:24:18 · 272 阅读 · 0 评论 -
【编程】【leetcode】541. Reverse String II
public class Solution { public String reverseStr(String s, int k) { char[] carr=s.toCharArray(); int i=0; int n=carr.length; while(i<n){原创 2017-04-05 20:08:48 · 338 阅读 · 0 评论 -
【编程】【动态规划】
package dynamic.B360;/** * 变态台阶问题 * http://www.cnblogs.com/batys/p/3329955.html * */import java.util.Scanner;public class Test { public static int FB(int i){ if (i==1){原创 2017-04-02 12:01:09 · 538 阅读 · 0 评论 -
【编程】2017年360春招编程题
1.数学期望package dynamic.B360;/** * http://blog.youkuaiyun.com/u011746554/article/details/66472433 * */import java.text.DecimalFormat;import java.util.Scanner;public class Test { public static vo原创 2017-04-01 22:24:37 · 381 阅读 · 0 评论 -
【编程】【leetcode】523. Continuous Subarray Sum
public class Solution { public boolean checkSubarraySum(int[] nums, int k) { int l=nums.length; //如果区分第一个元素不为k 那么就可以根据sum%k来判断是否返回true //反之 根据sum%k存在一定的缺陷 6 1 1 1 /原创 2017-04-09 19:28:57 · 446 阅读 · 0 评论 -
【编程】【leetcode】276 Paint Fence
public int numWays(int n, int k) { if(n == 0){ return 0; } if(n == 1){ return k; } if (n==2) { return k*k; } int diffColorCounts = k*(k-1); int sameColorCounts = k; for(int i=3; i<原创 2017-04-09 18:40:02 · 528 阅读 · 0 评论 -
【编程】【leetcode】303. Range Sum Query - Immutable
//题目描述:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumR原创 2017-04-09 17:03:35 · 470 阅读 · 0 评论 -
【编程】【2017京东java实习生编程题】异或
题目:http://exercise.acmcoder.com/online/online_judge_ques?ques_id=4397&konwledgeId=41package com.smart.reflect;import java.util.Scanner;public class Main { public static void main(String[原创 2017-04-09 00:35:10 · 789 阅读 · 0 评论 -
【编程】【2017京东java实习生编程题】分堆
题目http://exercise.acmcoder.com/online/online_judge_ques?ques_id=4410&konwledgeId=41import java.util.Scanner;/** * 分堆主要是考察思维逻辑 * 想要尽可能多的堆数 那就是k k+1 k...不浪费一点石头 * */public class Main {原创 2017-04-09 00:21:32 · 914 阅读 · 0 评论 -
【编程】记录曾经写过的那些代码
1.判断一年中具体某一天是一年中第几天import java.util.Calendar;import java.util.Scanner;public class MyCalendar { public static void main(String[] args){ Scanner in =new Scanner(System.in);原创 2017-09-23 15:54:19 · 975 阅读 · 0 评论