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. 阅读代码工具:Visual Studio Code

    打开一个文件夹,直接阅读,体验还不错 版本: 1.25.1提交: 1dfc5e557209371715f655691b1235b6b26a06be日期: 2018-07-11T15:43:11.471 ...

  2. android开发-c++代码调用so库

    Android项目的CMakeLists.txt代码如下,so文件放在项目的$Project/app/src/main/jniLibs/$arch下,$arch替换为arm64-v8a armv7a等 ...

  3. Oracle 学习之触发器

    1. 触发器简介 触发器是存储在数据库服务器中的程序单元,当一个表或一个视图被改变,或者数据库发生某些事件时,Oracle会自动触发触发器,并执行触发器中的代码.只有在触发器中定义的事件发生时,触发器 ...

  4. 生产环境mysql的参数设置不一样,好好的程序,又出错

    一.概述 报错信息如下: org.springframework.jdbc.BadSqlGrammarException: ### Error querying database.  Cause: c ...

  5. nginx命令行参数和信号

    nginx命令行参数 [user@host dir]$ /usr/local/nginx/sbin/nginx -hnginx version: nginx/1.8.0Usage: nginx [-? ...

  6. 渗透中Meterpreter基本操作和对应的windows上的排查或者现象

    Meterpreter的简单介绍 Meterpreter 是MSF自带一个强大的SHELL,可以执行很多功能. Meterpreter SHELL 基本操作 meterpreter>backgr ...

  7. Unity3D笔记二十 多媒体与网络

    1 游戏音频 1.游戏音乐:如游戏背景音乐 2.游戏音效:如开枪或打怪物时“砰砰”的游戏音效 Unity 3D游戏引擎共支持4种音乐格式的文件,具体如下. aiff:适用于较短的音乐文件,可用作游戏音 ...

  8. vue之创建组建

    vue的核心基础就是组件的使用,玩好了组件才能将前面学的基础更好的运用起来.组件的使用更使我们的项目解耦合.更加符合vue的设计思想MVVM. 那接下来就跟我看一下如何在一个Vue实例中使用组件吧! ...

  9. POJ-2029 Get Many Persimmon Trees(动态规划)

    Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3987 Accepted: 2 ...

  10. zero-shor learning 数据集

    OSR数据集下载地址: http://people.csail.mit.edu/torralba/code/spatialenvelope/ Relative Attributes Marr Priz ...