Remove Duplicates from unsorted array,它的错误在于9-10行k out of bound,改成下面这样就没问题了

 public class removeDuplicates {
public static int[] remove(int[] arr){ int end = arr.length; for(int i = 0; i < end; i++){
for(int j = i + 1; j < end; j++){
if(arr[i] == arr[j]){
for(int k = j+1; k < end; k++){
arr[k-1] = arr[k];
}
end--;
j--;
}
}
} int[] whitelist = new int[end];
for(int i = 0; i < end; i++){
whitelist[i] = arr[i];
}
System.out.print("new length is ");
System.out.println(end);
return whitelist;
} public static void main(String[] args) {
int[] arr = {3, 2, 1, 3, 2, 1, 3, 2, 1};
remove(arr);
for(int i:arr){
System.out.print(i);
System.out.print(", ");
}
}
}

Selection Sort Ascending order, 它的错误在于7行大于小于错误

     public static int[] doSelectionSort(int[] arr){

         for (int i = 0; i < arr.length-1; i++)
{
int index = i;
for (int j = i + 1; j < arr.length; j++)
if (arr[j] < arr[index])
index = j; int smallerNumber = arr[index];
arr[index] = arr[i];
arr[i] = smallerNumber;
}
return arr;
}

Selection Sort Dscending order, 他的错误在于第5行大于小于错误

     public static int[] doSelectionSort(int[] arr){
for (int i=0; i<arr.length-1; i++) {
int max = i;
for (int j=1; j<arr.length; j++) {
if (max < arr[j]) {
max = j;
}
}
if (max != i) {
int temp = arr[i];
arr[i] = arr[max];
arr[max] = temp;
}
}
return arr;
}

Reverse an int array, 它的问题在于第3行忘了-1

 for (int i=0; i<arr.length/2; i++) {
int temp = arr[i];
arr[i] = arr[arr.length-1-i];
arr[arr.length-1-i] = temp; }

Print Pattern, 打印11, 1111, 111111,中间需要换行,它的问题在于括号少打了

Amazon OA的更多相关文章

  1. Amazon | OA 2019 | Optimal Utilization

    Given 2 lists a and b. Each element is a pair of integers where the first integer represents the uni ...

  2. 标准产品+定制开发:专注打造企业OA、智慧政务云平台——山东森普软件,交付率最高的技术型软件公司

    一.公司简介山东森普信息技术有限公司(以下简称森普软件)是一家专门致力于移动互联网产品.企业管理软件定制开发的技术型企业.公司总部设在全国五大软件园之一的济南齐鲁软件园.森普SimPro是由Simpl ...

  3. 港真,到底应该选择OA还是BPM?

    越来越多企业意识到流程管理的重要性,但是,选择OA还是BPM,却让他们产生了选择困难症. 一方面,企业皆注重流程的高效运转,最好内外部的业务都能用一个系统来解决.所有流程一天就能上线什么的,那就更好啦 ...

  4. 从零到有——我的OA如何成长

    早前发文说要分享,马上进入了财务系统的开发,拖到现在,见笑了. 我在月初离职了,所以到处跑,找工作,想想南京.苏州.无锡(去玩的).杭州(路过).上海.珠海.深圳.广州.觉得找工作也差不多尾声了,就留 ...

  5. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(3): 抓取amazon.com价格

    通过上一篇随笔的处理,我们已经拿到了书的书名和ISBN码.(网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(2): 抓取allitebooks.com书籍信息 ...

  6. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(2): 抓取allitebooks.com书籍信息及ISBN码

    这一篇首先从allitebooks.com里抓取书籍列表的书籍信息和每本书对应的ISBN码. 一.分析需求和网站结构 allitebooks.com这个网站的结构很简单,分页+书籍列表+书籍详情页. ...

  7. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(1): 基础知识Beautiful Soup

    开始学习网络数据挖掘方面的知识,首先从Beautiful Soup入手(Beautiful Soup是一个Python库,功能是从HTML和XML中解析数据),打算以三篇博文纪录学习Beautiful ...

  8. OA办公自动化系统源码

    最新extjs6富客户端,.net平台开发,sql server数据库,基础权限人员基础平台,可方便二次开发,使用EF为orm,autofac为ioc,Castle为基础的aop,实现常用OA系统功能 ...

  9. Amazon Interview | Set 27

    Amazon Interview | Set 27 Hi, I was recently interviewed for SDE1 position for Amazon and got select ...

随机推荐

  1. git上传GitHub并预览

  2. nginx 日志文件

    默认日志格式 log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status ...

  3. 【CF896D】Nephren Runs a Cinema 卡特兰数+组合数+CRT

    [CF896D]Nephren Runs a Cinema 题意:一个序列中有n格数,每个数可能是0,1,-1,如果一个序列的所有前缀和都>=0且总和$\in [L,R]$,那么我们称这个序列是 ...

  4. Android ActivityManager与WindowManager

    <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission ...

  5. thinkphp---模糊查询详解

    最近做项目,在做搜索模块的时候,模糊查询肯定少不了. 今天就详细的看一下模糊查询: $where['title'] = array('like','%'.$words.'%'); $where['ti ...

  6. Java实现网易企业邮箱发送邮件

    最近项目需要用网易企业邮箱发送邮件,特意来将实现过程记录一下: maven导入jar包 <!-- javax.mai 核心包 --> <dependency> <grou ...

  7. HTML的常用总结

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Oracle故障排查之oracle解决锁表问题

    --step 1:查看被阻塞会话等待事件 select sid, event, username, lockwait, sql.sql_text  from v$session s, v$sql sq ...

  9. Python:fromkeys()方法

    简介 Python 字典(Dictionary) fromkeys() 函数用于创建一个新字典,以序列seq中元素做字典的键,value为字典所有键对应的初始值. 语法 fromkeys()方法语法: ...

  10. mybatis-3 cache 源码赏析

    总结: 从缓存策略源码,可以分析java相关类库 mybatis-3/src/main/java/org/apache/ibatis/cache/decorators/SoftCache.java p ...