ArrayDeque in Java[通俗易懂]

ArrayDeque in Java[通俗易懂]ArrayDequeinJavaArrayDequeinJavaprovidesawaytoapplyresizable-arrayinadditiontotheimplementationoftheDequeinterface.ItisalsoknownasArrayDoubleEndedQueueorArrayDeck.Thi…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

ArrayDeque in Java

ArrayDeque in Java provides a way to apply resizable-array in addition to the implementation of the Deque interface. It is also known as Array Double Ended Queue or Array Deck. This is a special kind of array that grows and allows users to add or remove an element from both the sides of the queue. Few important features of ArrayDeque are as follows:

  • Array deques have no capacity restrictions and they grow as necessary to support usage.
  • They are not thread-safe which means that in the absence of external synchronization, ArrayDeque does not support concurrent access by multiple threads.
  • Null elements are prohibited in the ArrayDeque.
  • ArrayDeque class is likely to be faster than Stack when used as a stack.
  • ArrayDeque class is likely to be faster than LinkedList when used as a queue.

Declaration:

public class ArrayDeque Element
   extends AbstractCollection
   implements DequeElement, Cloneable, Serializable

Here, Element refers to the element which can refer to any class, such as Integer or Stringclass.

Constructors in ArrayDeque:

  1. ArrayDeque(): Used to create an empty ArrayDeque and by default holds an initial capacity to hold 16 elements.
  2. ArrayDeque(Collection c): Used to create an ArrayDeque containing all the elements same as that of the specified collection.
  3. ArrayDeque(int numofElements): Used to create an empty ArrayDeque wand holds the capacity to contain a specified number of elements.

Example:

// Java program to demonstrate few functions of 
// ArrayDeque in Java 

import java.util.*; 
public class ArrayDequeDemo 
{ 
	public static void main(String[] args) 
	{ 
		// Intializing an deque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(10); 

		// add() method to insert 
		de_que.add(10); 
		de_que.add(20); 
		de_que.add(30); 
		de_que.add(40); 
		de_que.add(50); 
		for (Integer element : de_que) 
		{ 
			System.out.println("Element : " + element); 
		} 

		System.out.println("Using clear() "); 

		// clear() method 
		de_que.clear(); 

		// addFirst() method to insert at start 
		de_que.addFirst(564); 
		de_que.addFirst(291); 

		// addLast() method to insert at end 
		de_que.addLast(24); 
		de_que.addLast(14); 

		System.out.println("Above elements are removed now"); 

		// Iterator() : 
		System.out.println("Elements of deque using Iterator :"); 
		for(Iterator itr = de_que.iterator(); itr.hasNext();) 
		{ 
			System.out.println(itr.next()); 
		} 

		// descendingIterator() : to reverse the deque order 
		System.out.println("Elements of deque in reverse order :"); 
		for(Iterator dItr = de_que.descendingIterator(); 
											dItr.hasNext();) 
		{ 
			System.out.println(dItr.next()); 
		} 

		// element() method : to get Head element 
		System.out.println("\nHead Element using element(): " + 
											de_que.element()); 

		// getFirst() method : to get Head element 
		System.out.println("Head Element using getFirst(): " + 
											de_que.getFirst()); 

		// getLast() method : to get last element 
		System.out.println("Last Element using getLast(): " + 
												de_que.getLast()); 

		// toArray() method : 
		Object[] arr = de_que.toArray(); 
		System.out.println("\nArray Size : " + arr.length); 

		System.out.print("Array elements : "); 
		for(int i=0; i<arr.length ; i++) 
			System.out.print(" " + arr[i]); 
			
		// peek() method : to get head 
		System.out.println("\nHead element : " + de_que.peek()); 
		
		// poll() method : to get head 
		System.out.println("Head element poll : " + de_que.poll()); 
		
		// push() method : 
		de_que.push(265); 
		de_que.push(984); 
		de_que.push(2365); 
		
		// remove() method : to get head 
		System.out.println("Head element remove : " + de_que.remove()); 
		
		System.out.println("The final array is: "+de_que); 
	} 
} 

Output:

Element : 10
Element : 20
Element : 30
Element : 40
Element : 50
Using clear() 
Above elements are removed now
Elements of deque using Iterator :
291
564
24
14
Elements of deque in reverse order :
14
24
564
291

Head Element using element(): 291
Head Element using getFirst(): 291
Last Element using getLast(): 14

Array Size : 4
Array elements :  291 564 24 14
Head element : 291
Head element poll : 291
Head element remove : 2365
The final array is: [984, 265, 564, 24, 14]

Methods in ArrayDeque:

  1. add(Element e) : The method inserts particular element at the end of the deque.
  2. addFirst(Element e) : The method inserts particular element at the start of the deque.
  3. addLast(Element e) : The method inserts particular element at the end of the deque. It is similiar to add() method
  4. clear() : The method removes all deque elements.
  5. size() : The method returns the no. of elements in deque.
  6. clone() : The method copies the deque.
  7. contains(Obj) : The method checks whether a deque contains the element or not
  8. Iterator() : The method returns an iterator over the deque.
  9. descendingIterator() : The method returns a reverse order iterator over the deque
  10. element() : The method returns element at the head of the deque
  11. getFirst(): The method returns first element of the deque
  12. getLast(): The method returns last element of the deque
  13. isEmpty(): The method checks whether the deque is empty or not.
  14. toArray(): The method returns array having the elements of deque.
  15. offer(Element e) : The method inserts element at the end of deque.
  16. offerFirst(Element e) : The method inserts element at the front of deque.
  17. offerLast(Element e) : The method inserts element at the end of deque.
  18. peek() : The method returns head element without removing it.
  19. peekFirst() : The method returns first element without removing it.
  20. peekLast() : The method returns last element without removing it.
  21. poll() : The method returns head element and also removes it
  22. pollFirst() : The method returns first element and also removes it
  23. pollLast() : The method returns last element and also removes it
  24. pop() : The method pops out an element for stack repesented by deque
  25. push(Element e) : The method pushes an element onto stack repesented by deque
  26. remove() : The method returns head element and also removes it
  27. removeFirst() : The method returns first element and also removes it
  28. removeLast() : The method returns last element and also removes it
  29. removeFirstOccurrence(Obj) : The method removes the element where it first occur in the deque.
  30. removeLastOccurrence(Obj) : The method removes the element where it last occur in the deque.

ArrayDeque addFirst() Method in Java

The java.util.ArrayDeque.addFirst(Object element) method in Java is used to insert a specific element at the front of this deque.

Syntax:

Array_Deque.addFirst(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added.

Return Value: The function does not return any value.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.addFirst() method:
Program 1:

// Java code to illustrate addFirst() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Adding elements at front 
		de_que.addFirst(40); 
		de_que.addFirst(50); 
		de_que.addFirst(60); 
		de_que.addFirst(70); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque_front_addition: " + de_que); 

		// Adding elements using add() 
		de_que.add(1); 
		de_que.add(2); 
		de_que.add(3); 

		// Displaying the final ArrayDeque 
		System.out.println("Final ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]
ArrayDeque_front_addition: [70, 60, 50, 40, 10, 15, 30, 20, 5]
Final ArrayDeque: [70, 60, 50, 40, 10, 15, 30, 20, 5, 1, 2, 3]

ArrayDeque add() Method in Java

The Java.util.ArrayDeque.add(Object element) method in Java is used to add a specific element at the end of the Deque. The function is similar to the addLast() method of ArrayDeque in Java.

Syntax:

Array_Deque.add(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added to the Deque.

Return Value: The function returns True if the element is successfully added into the deque else it returns false.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.add() method:
Program 1: Adding String elements into the Deque.

// Java code to illustrate add() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]

Program 2: Adding Integer elements into the Deque.

// Java code to illustrate add() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]

ArrayDeque addLast() Method in Java

The java.util.ArrayDeque.addLast(Object element) method in Java is used to insert a specific element at the end of this deque. It is similar to the add() method in Java.

Syntax:

Array_Deque.addLast(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added.

Return Value: The function does not return any value.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.addLast() method:
Program 1: Adding Integers to the Deque.

// Java code to illustrate addLast() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Adding elements at the end 
		de_que.addLast(40); 
		de_que.addLast(50); 
		de_que.addLast(60); 
		de_que.addLast(70); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque_end_addition: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]
ArrayDeque_end_addition: [10, 15, 30, 20, 5, 40, 50, 60, 70]

ArrayDeque getFirst() Method in Java

The java.util.ArrayDeque.getFirst() method in Java is used to retrieve or fetch the first element of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the first element of the deque.

Syntax:

Array_Deque.getFirst()

Parameters: The method does not take any parameter.

Return Value: The method returns the first element present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.getFirst() method:

Program 1:

// Java code to illustrate getFirst() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the first element 
		System.out.println("The first element is: " + 
									de_que.getFirst()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The first element is: Welcome

ArrayDeque isEmpty() Method in Java

The Java.util.ArrayDeque.isEmpty() method in Java is used to check and verify if an ArrayDeque is empty or not. It returns True if the Deque is empty else it returns False.

Syntax:

Array_Deque.isEmpty()

Parameters: The method does not take any parameter.

Return Value: The function returns True if the deque is empty else it returns False.

Below programs illustrate the Java.util.ArrayDeque.isEmpty() method:

Program 1:

// Java code to illustrate isEmpty() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Verifying if the Deque is empty or not 
		System.out.println("The Deque is empty? " + 
									de_que.isEmpty()); 

		// Clearing the deque 
		de_que.clear(); 

		// Verifying if the Deque is empty or not 
		System.out.println("The Deque is empty? " + 
									de_que.isEmpty()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The Deque is empty? false
The Deque is empty? true

ArrayDeque clear() Method in Java

The Java.util.ArrayDeque.clear() method in Java is used to remove all of the elements from the Deque. Using the clear() method only clears all the element from the deque and does not delete the deque. In other words, it can be said that the clear() method is used to only empty an existing ArrayDeque.

Syntax:

Array_Deque.clear()

Parameters: The method does not take any parameter.

Return Value: The function does not return any value.

Below programs illustrate the Java.util.ArrayDeque.clear() method:
Program 1:

// Java code to illustrate clear() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Clearing the Deque 
		de_que.clear(); 

		// Displaying the Deque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
ArrayDeque: []

ArrayDeque size() Method in Java

The Java.util.ArrayDeque.size() method in Java is used to get the size of the Deque or the number of elements present in the Deque.

Syntax:

Array_Deque.size()

Parameters: The method does not take any parameter.

Return Value: The method returns the size or the number of elements present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.size() method:
Program 1: Adding String elements into the Deque.

// Java code to illustrate size() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the size of Deque 
		System.out.println("The size is: " + de_que.size()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The size is: 5

ArrayDeque contains() Method in Java

The Java.util.ArrayDeque.contains() method in Java is used to check or verify whether a specific element is present in the Deque or not.

Syntax:

Array_Deque.contains(Object element)

Parameters: The parameter element is of the type of ArrayDeque. This is the element that needs to be tested if it is present in the deque or not.

Return Value: The method returns True if the element is present in the deque otherwise it returns False.

Below programs illustrate the Java.util.ArrayDeque.contains() method:
Program 1:

// Java code to illustrate contains() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Queue 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Check for "Geeks" in the deque 
		System.out.println("Does the deque contains 'Geeks'? "
						+ de_que.contains("Geeks")); 

		// Check for "4" in the deque 
		System.out.println("Does the deque contains '4'? "
						+ de_que.contains("4")); 

		// Check if the deque contains "No" 
		System.out.println("Does the deque contains 'No'? "
						+ de_que.contains("No")); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
Does the deque contains 'Geeks'? true
Does the deque contains '4'? true
Does the deque contains 'No'? false

ArrayDeque iterator() Method in Java

The Java.util.ArrayDeque.iterator() method is used to return an iterator of the elements of the ArrayDeque.

Syntax:

Iterator iterate_value = Array_Deque.iterator();

Parameters: The method does not take any parameter.

Return Value: The method iterates over the elements of the deque and returns the values(iterator).

Below programs illustrate the Java.util.ArrayDeque.iterator() method:
Program 1:

// Java code to illustrate iterator() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Queue 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Creating an iterator 
		Iterator value = de_que.iterator(); 

		// Displaying the values after iterating through the Deque 
		System.out.println("The iterator values are: "); 
		while (value.hasNext()) { 
			System.out.println(value.next()); 
		} 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The iterator values are: 
Welcome
To
Geeks
4
Geeks

ArrayDeque getLast() Method in Java

The java.util.ArrayDeque.getLast() method in Java is used to retrieve or fetch the last element of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the last element of the deque.

Syntax:

Array_Deque.getLast()

Parameters: The method does not take any parameter.

Return Value: The method returns the last element present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.getLast() method:

Program 1:

// Java code to illustrate getLast() method of ArrayDeque 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the Last element 
		System.out.println("The last element is: " + de_que.getLast()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The last element is: Geeks

ArrayDeque element() Method in Java

The java.util.ArrayDeque.element() method in Java is used to retrieve or fetch the head of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the element.

Syntax:

Array_Deque.element()

Parameters: The method does not take any parameter.

Return Value: The method returns the element present at the head of the Deque.

Below programs illustrate the Java.util.ArrayDeque.element() method:
Program 1:

// Java code to illustrate ArrayDeque element() method 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the head 
		System.out.println("The head element is: " + de_que.element()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The head element is: Welcome

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/191300.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • JVM 优化实战[通俗易懂]

    JVM 优化实战[通俗易懂]本文讲解了JVM的内存划分和分配策略,并以截图和脚本展示常用可视化和命令行工具的使用方法,完整演示了JVM优化、内存泄露排查、gc.log分析方法等。作者:王克锋 出处:https://kefeng.wang/2016/11/22/java-jvm/ 版权:自由转载-非商用-非衍生-保持署名,转载请标明作者和出处。1GC相关内存1.1内存划分1.1.1堆(Heap)存放 newM…

  • 我眼中的2011年互联网大事记「建议收藏」

    我眼中的2011年互联网大事记「建议收藏」  2011年这一年中国的互联网发生了很多事,有人缔造了新的商业模式,有人靠一个点子拿到了百万美金,有人如愿找到了一份满意的工作,有人通过网站挣到人生第一笔财富。  每个人眼中都有着属于自己的互联网大事记,本文将讲诉:2011年,我眼中的互联网大事记。  一、互联网聚会越来越多  今年关乎互联网站长聚会越来越多,不仅仅是站长大会,关于互联网创业的聚会越来越多,而且有越来越多的团…

  • 考核题2「建议收藏」

    6.springmvc的工作流程是什么?SpringMVC流程1、用户向服务端发送一次请求,这个请求会先到前端控制器DispatcherServlet(也叫中央控制器)。2、DispatcherServlet接收到请求后会调用HandlerMapping处理器映射器。由此得知,该请求该由哪个Controller来处理(并未调用Controller,只是得知)3、DispatcherServlet调用HandlerAdapter处理器适配器,告诉处理器适配器应该要去执行哪个Controll

  • vim and python

    vim and python

  • noip2018提高组初赛解析_noip小学组

    noip2018提高组初赛解析_noip小学组【问题简述】给定一个数n表示教室数接下来n个数r[i],表示每天可以借用的教室数量。有m份订单,每份订单有三个数d[i],s[i],t[i]。表示从S[i]天到t[i]天,借用d[i]个教室。现在询问能否满足所有订单。如果能,则输出0不能,则输出-1,换行输出最早不能满足的订单。【输入样例】432543213324424…

  • 手把手教你Charles抓包工具使用

    手把手教你Charles抓包工具使用Charles简介Charles是一个HTTP代理服务器,HTTP监视器,反转代理服务器,当浏览器连接Charles的代理访问互联网时,Charles可以监控浏览器发送和接收的所有数据。它允许一个开发者查看所有连接互联网的HTTP通信,这些包括request,response和HTTPheaders(包含cookies与caching信息)。Charles主要功能支持SSL代理。可以截取分析SSL的请求。支持流量控制。可以模拟慢速网络以及等待时间(latency)较长的请求。支持AJ

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号