輸入字串陣列a[0],a[1],...a[4]
利用Java Class LinkedList 作初一鏈結串列:
[ a[0], a[1], a[2], a[4], a[4],a[3],a[2],a[0] ]
Hint:可利用方法addFirst, add, remove.....
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
48 則留言:
import java.util.*;
public class B1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package V1;
import java.util.*;
public class B9933052A {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
public class a1 {
public static void main(String[] args) {
String arr[]={"你", "我", "他","YA","HI"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("HI");
if (x!=-1)
list.add(x,"你,他,YA,HI");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class a1{
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package P1;
import java.util.*;
public class B1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list= new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
public class b1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package pack;
import java.util.*;
public class pack {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package V1; import java.util.*; public class 2156415A { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package p1;
import java.util.*;
public class b1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4],a[3], a[2],a[0]");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class A1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class ex1
{
public static void main(String[] args)
{
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class ex1
{
public static void main(String[] args)
{
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class b1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[0],a[1],a[2],a[3],a[4]");
System.out.println(list);
}
}
package pack1;
import java.util.*;
public class t1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[0], a[1], a[2],a[3],a[4]");
System.out.println(list);
}
}
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
package p1;
import java.util.*;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList<String> list=new LinkedList<String>();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3] ,a[2], a[0]");
System.out.println(list);
}
}
package A11;
import java.util.*;
public class A11 {
public static void main(String[] args) {
String arr[]={"YA", "拉", "嘻","u","dk" };
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("dk");
if (x!=-1)
list.add(x,"YA,嘻,u,dk" );
System.out.println(list);
}
}
package a1;
import java.util.*;
public class p1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove("a[3]");
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.println(list);
}
}
package a1;
import java.util.*;
public class p1 {
public static void main(String[] args) {
String arr[]={"a[0]", "a[1]", "a[2]", "a[3]", "a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove("a[3]");
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.println(list);
}
}
package V1;
import java.util.*;
public class 12A {
public static void main(String[] args) {
Stringarr[]={“a[0]”, “a[1]”, “a[2]”, “a[3]”, “a[4]”};
LinkedList<<String> list=new LinkedList<<String>();
for(String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]);
System.out.println(list);
}
}
import java.util.*;
class test1114
{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
package P1 ;
import java.util.*;
class A{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
import java.util.*;
public class B9933024 {
[public static void main(String[] args)
[{
[[String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
[[list.add(x);
list.remove(3);
list.add("a[4]");
[[list.add("a[3]");
[[list.add("a[2]");
[[list.add("a[0]");
[System.out.print(list);
}
}
import java.util.*;
public class A2
{
public static void main(String[] args)
{
String arr[]={ "喜", "怒", "哀", "樂", "嘆" };
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.addFirst(x);
list.remove(3);
int x=list.indexOf("嘆");
if (x!=-1)
list.add(x,"喜, 怒, 哀, 嘆" );
System.out.println(list);
}
}
import java.util.*;
public class B9933051
{
public static void main(String[] args)
{
String arr[]={"I","YOU","SHE","HE","IT"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("IT");
list.add("HE");
list.add("SHE");
list.add("I");
System.out.print(list);
}
}
package pack1;
import java.util.*;
public class A1 {
public static void main(String[] args) {
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList< String > list= new LinkedList< String >();
for (String x :arr)
list.add(x);
list.remove(3);
int y=4;
list.add(y,"a[4], a[3], a[2], a[0]");
System.out.println(list);
}
}
import java.util.*;
class b9733054
{
public static void main(String[] args)
{
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"};
LinkedList<String> list=new LinkedList<String>();
for(String x:arr)
list.add(x);
list.remove(3);
list.add("a[4]");
list.add("a[3]");
list.add("a[2]");
list.add("a[0]");
System.out.print(list);
}
}
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package B1; import java.util.*; public class D { public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package A3;
import java.util.*;
public class A5 {
public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }
package A3;
import java.util.*;
public class A5 {
public static void main(String[] args) { String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList<String> list=new LinkedList<String>(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list); } }.
String arr[]={"a[0]","a[1]","a[2]","a[3]","a[4]"}; LinkedList list=new LinkedList(); for(String x:arr) list.add(x); list.remove(3); int y=4; list.add(y,"a[4], a[3], a[2], a[0]"); System.out.println(list);
張貼留言